@@ -695,9 +695,12 @@ define(function (require, exports, module) {
695695 * or the one for the current build.
696696 */
697697 function isWelcomeProjectPath ( path ) {
698+ var canonPath = FileUtils . canonicalizeFolderPath ( path ) ;
699+ if ( canonPath === _getWelcomeProjectPath ( ) ) {
700+ return true ;
701+ }
698702 var welcomeProjects = _prefs . getValue ( "welcomeProjects" ) || [ ] ;
699- welcomeProjects . push ( _getWelcomeProjectPath ( ) ) ;
700- return welcomeProjects . indexOf ( FileUtils . canonicalizeFolderPath ( path ) ) !== - 1 ;
703+ return welcomeProjects . indexOf ( canonPath ) !== - 1 ;
701704 }
702705
703706 /**
@@ -755,6 +758,7 @@ define(function (require, exports, module) {
755758 var rootEntry = fs . root ;
756759 var projectRootChanged = ( ! _projectRoot || ! rootEntry ) ||
757760 _projectRoot . fullPath !== rootEntry . fullPath ;
761+ var i ;
758762
759763 // Success!
760764 var perfTimerName = PerfUtils . markStart ( "Load Project: " + rootPath ) ,
@@ -1328,9 +1332,26 @@ define(function (require, exports, module) {
13281332
13291333 // Init PreferenceStorage
13301334 var defaults = {
1331- projectPath : _getWelcomeProjectPath ( ) /* initialize to brackets source */
1335+ projectPath : _getWelcomeProjectPath ( ) /* initialize to welcome project */
13321336 } ;
13331337 _prefs = PreferencesManager . getPreferenceStorage ( PREFERENCES_CLIENT_ID , defaults ) ;
1338+
1339+ if ( ! _prefs . getValue ( "welcomeProjectsFixed" ) ) {
1340+ // One-time cleanup of duplicates in the welcome projects list--there used to be a bug where
1341+ // we would add lots of duplicate entries here.
1342+ var welcomeProjects = _prefs . getValue ( "welcomeProjects" ) ;
1343+ if ( welcomeProjects ) {
1344+ var newWelcomeProjects = [ ] ;
1345+ var i ;
1346+ for ( i = 0 ; i < welcomeProjects . length ; i ++ ) {
1347+ if ( newWelcomeProjects . indexOf ( welcomeProjects [ i ] ) === - 1 ) {
1348+ newWelcomeProjects . push ( welcomeProjects [ i ] ) ;
1349+ }
1350+ }
1351+ _prefs . setValue ( "welcomeProjects" , newWelcomeProjects ) ;
1352+ _prefs . setValue ( "welcomeProjectsFixed" , true ) ;
1353+ }
1354+ }
13341355
13351356 // Event Handlers
13361357 $ ( FileViewController ) . on ( "documentSelectionFocusChange" , _documentSelectionFocusChange ) ;
0 commit comments