@@ -742,8 +742,8 @@ define(function (require, exports, module) {
742742 return ProjectModel . _ensureTrailingSlash ( Phoenix . VFS . getDefaultProjectDir ( ) ) ;
743743 }
744744
745- function _getPlaceholderProjectPath ( ) {
746- return "/no_project_loaded" ;
745+ function getPlaceholderProjectPath ( ) {
746+ return "/no_project_loaded/ " ;
747747 }
748748
749749 function getExploreProjectPath ( ) {
@@ -1151,36 +1151,43 @@ define(function (require, exports, module) {
11511151 } ) ;
11521152 }
11531153
1154- function _loadWelcomeProject ( welcomeProjectPath ) {
1154+ function _loadWelcomeProject ( ) {
1155+ const welcomeProjectPath = getWelcomeProjectPath ( ) ;
11551156 const result = new $ . Deferred ( ) ;
11561157 const rootEntry = FileSystem . getDirectoryForPath ( welcomeProjectPath ) ;
11571158 function _loadRootEntry ( ) {
11581159 _loadExistingProject ( rootEntry )
11591160 . done ( result . resolve )
11601161 . fail ( result . reject ) ;
11611162 }
1163+ function _loadPlaceholderProject ( ) {
1164+ // default project could not be created. As a last ditch effort to continue boot, we will
1165+ // use a vfs path `/no_project_loaded` to continue boot.
1166+ Phoenix . VFS . ensureExistsDir ( getPlaceholderProjectPath ( ) , ( placeHolderErr ) => {
1167+ if ( placeHolderErr ) {
1168+ window . logger . reportError ( placeHolderErr , "Error creating /no_project_loaded" ) ;
1169+ alert ( "Unrecoverable error, startup project could not be created." ) ;
1170+ return ;
1171+ }
1172+ const placeholderProject = FileSystem . getDirectoryForPath ( getPlaceholderProjectPath ( ) ) ;
1173+ _loadExistingProject ( placeholderProject )
1174+ . done ( result . resolve )
1175+ . fail ( result . reject ) ;
1176+ } ) ;
1177+ }
11621178 rootEntry . exists ( function ( err , exists ) {
11631179 if ( exists ) {
11641180 _loadRootEntry ( ) ;
11651181 } else {
1166- // create the welcome project
1182+ // create the welcome project only on first boot in desktop builds. The user may delete the phoenix
1183+ // project directory as he doesn't want phoenix folders in his documents. we should respect that.
1184+ if ( Phoenix . isNativeApp && ! Phoenix . firstBoot ) {
1185+ _loadPlaceholderProject ( ) ;
1186+ return ;
1187+ }
11671188 _createDefaultProject ( )
11681189 . then ( _loadRootEntry )
1169- . catch ( ( ) => {
1170- // default project could not be created. As a last ditch effort to continue boot, we will
1171- // use a vfs path `/no_project_loaded` to continue boot.
1172- Phoenix . VFS . ensureExistsDir ( _getPlaceholderProjectPath ( ) , ( placeHolderErr ) => {
1173- if ( placeHolderErr ) {
1174- window . logger . reportError ( placeHolderErr , "Error creating /no_project_loaded" ) ;
1175- alert ( "Unrecoverable error, startup project could not be created." ) ;
1176- return ;
1177- }
1178- const placeholderProject = FileSystem . getDirectoryForPath ( _getPlaceholderProjectPath ( ) ) ;
1179- _loadExistingProject ( placeholderProject )
1180- . done ( result . resolve )
1181- . fail ( result . reject ) ;
1182- } ) ;
1183- } ) ;
1190+ . catch ( _loadPlaceholderProject ) ;
11841191 }
11851192 } ) ;
11861193 return result . promise ( ) ;
@@ -1255,7 +1262,7 @@ define(function (require, exports, module) {
12551262 }
12561263 if ( rootPath === getWelcomeProjectPath ( ) ) {
12571264 // welcome project path is always guaranteed to be present!
1258- return _loadWelcomeProject ( rootPath ) ;
1265+ return _loadWelcomeProject ( ) ;
12591266 }
12601267 return _loadProjectInternal ( rootPath ) ;
12611268 }
@@ -2220,6 +2227,7 @@ define(function (require, exports, module) {
22202227 exports . getStartupProjectPath = getStartupProjectPath ;
22212228 exports . getProjectRelativePath = getProjectRelativePath ;
22222229 exports . getWelcomeProjectPath = getWelcomeProjectPath ;
2230+ exports . getPlaceholderProjectPath = getPlaceholderProjectPath ;
22232231 exports . getExploreProjectPath = getExploreProjectPath ;
22242232 exports . getLocalProjectsPath = getLocalProjectsPath ;
22252233 exports . isWelcomeProjectPath = isWelcomeProjectPath ;
0 commit comments