1
Vote

addGeneratedFiles bug

description

Hi,
 
In Connect.cs line 708 method addGeneratedFiles has the lambda's backwards for directory and file filtering, plus the compare will probably never work for the file filter:
 
    /// <summary>
    /// Adds the generated files to a specific project but does not include the subversion files.
    /// </summary>
    /// <param name="project">Project to add the generated files to</param>
    /// <param name="directory">Directory that contains the generated files</param>
    private static void addGeneratedFiles(Project project, string directory)
    {
        addFilesToProject(project, directory, 
            /* don't include .svn files */      d => d == ".svn", 
            /* and don't include "hash" dirs */ f => f.ToLower() == "hash");
    }
 
I've improved/fixed it to look like this:
 
    /// <summary>
    /// Adds the generated files to a specific project but does not include the subversion files.
    /// </summary>
    /// <param name="project">Project to add the generated files to</param>
    /// <param name="directory">Directory that contains the generated files</param>
    private static void addGeneratedFiles(Project project, string directory)
    {
        addFilesToProject(project, directory,
            /* and don't include "hash" dirs */   d => d.ToLower() == "hash",
            /* don't include .svn & .scc files */ f => f.ToLower().EndsWith(".svn") || f.ToLower().EndsWith(".scc"));
    }
 
It now also filters source safe files and checks only if the filename ends with the string.
 
Regards,
Bart

comments

bacobart wrote May 6, 2010 at 11:33 AM

I just realized it's probably .svn directories that don't have to be added, and not files as stated by the comment. The correct version should probably look like this:
    /// <summary>
    /// Adds the generated files to a specific project but does not include the subversion files.
    /// </summary>
    /// <param name="project">Project to add the generated files to</param>
    /// <param name="directory">Directory that contains the generated files</param>
    private static void addGeneratedFiles(Project project, string directory)
    {
        addFilesToProject(project, directory,
            /* don't include .svn dirs */         d => d == ".svn",
            /* don't include .scc & hash files */ f => f.ToLower() == "hash" || f.ToLower() == "checksum" || f.ToLower().EndsWith(".scc"));
    }

wrote Feb 13, 2013 at 11:28 PM