@@ -24,8 +24,9 @@ public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranc
2424 getGitBranch , getPlasticBranch , getArguments ,
2525 showMissingFolders , showTargetPlatform , searchGitbranchRecursively , showSRP ,
2626 project =>
27- {
28- projectsFound . Add ( project ) ;
27+ {
28+ if ( ! projectsFound . ContainsProjectWithPath ( project . Path ) )
29+ projectsFound . Add ( project ) ;
2930
3031 // TODO FIXME, this gets called everytime for same projects?
3132 // add found projects to history also (gets added only if its not already there)
@@ -41,19 +42,9 @@ public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranc
4142 // iterate custom full projects history
4243 foreach ( var projectPath in AllProjectPaths )
4344 {
44- // check if registry list contains this path already, then skip it
45- bool found = false ;
46- for ( int i = 0 , len = projectsFound . Count ; i < len ; i ++ )
47- {
48- if ( projectsFound [ i ] . Path == projectPath )
49- {
50- found = true ;
51- break ;
52- }
53- }
54-
45+ // check if registry list contains this path already
5546 // if not found from registry, add to recent projects list
56- if ( found == false )
47+ if ( ! projectsFound . ContainsProjectWithPath ( projectPath ) )
5748 {
5849 var p = GetProjectInfo ( projectPath , getGitBranch , getPlasticBranch , getArguments , showMissingFolders , showTargetPlatform , searchGitbranchRecursively , showSRP ) ;
5950 if ( p != null ) projectsFound . Add ( p ) ;
@@ -82,7 +73,7 @@ public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranc
8273 } // Scan()
8374
8475 // visits each project stored in the Unity registry, invoking the visitor for each one
85- static void VisitProjectsInRegistry (
76+ private static void VisitProjectsInRegistry (
8677 bool getGitBranch , bool getPlasticBranch , bool getArguments ,
8778 bool showMissingFolders , bool showTargetPlatform , bool searchGitbranchRecursively , bool showSRP ,
8879 Action < Project > visitor )
@@ -136,6 +127,16 @@ static void VisitProjectsInRegistry(
136127 } // for each registry root
137128 } // VisitProjectsInRegistry()
138129
130+ private static bool ContainsProjectWithPath ( this List < Project > projects , string projectPath )
131+ {
132+ foreach ( var p in projects )
133+ {
134+ if ( string . Equals ( p . Path , projectPath , StringComparison . OrdinalIgnoreCase ) )
135+ return true ;
136+ }
137+ return false ;
138+ }
139+
139140 static Project GetProjectInfo ( string projectPath , bool getGitBranch = false , bool getPlasticBranch = false , bool getArguments = false , bool showMissingFolders = false , bool showTargetPlatform = false , bool searchGitbranchRecursively = false , bool showSRP = false )
140141 {
141142 bool folderExists = Directory . Exists ( projectPath ) ;
0 commit comments