Skip to content

Commit a7e38ec

Browse files
committed
chore: welcome project is always fallback instead of opening random project
1 parent ff90273 commit a7e38ec

File tree

1 file changed

+5
-58
lines changed

1 file changed

+5
-58
lines changed

src/project/ProjectManager.js

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -792,53 +792,6 @@ define(function (require, exports, module) {
792792

793793
}
794794

795-
/**
796-
* After failing to load a project, this function determines which project path to fallback to.
797-
* @return {$.Promise} Promise that resolves to a project path {string}
798-
*/
799-
function _getFallbackProjectPath() {
800-
var fallbackPaths = [],
801-
recentProjects = PreferencesManager.getViewState("recentProjects") || [],
802-
deferred = new $.Deferred();
803-
804-
// Build ordered fallback path array
805-
if (recentProjects.length > 1) {
806-
// *Most* recent project is the one that just failed to load, so use second most recent
807-
fallbackPaths.push(recentProjects[1]);
808-
}
809-
810-
// Next is Getting Started project
811-
fallbackPaths.push(getWelcomeProjectPath());
812-
813-
// Helper func for Async.firstSequentially()
814-
function processItem(path) {
815-
var deferred = new $.Deferred(),
816-
fileEntry = FileSystem.getDirectoryForPath(path);
817-
818-
fileEntry.exists(function (err, exists) {
819-
if (!err && exists) {
820-
deferred.resolve();
821-
} else {
822-
deferred.reject();
823-
}
824-
});
825-
826-
return deferred.promise();
827-
}
828-
829-
// Find first path that exists
830-
Async.firstSequentially(fallbackPaths, processItem)
831-
.done(function (fallbackPath) {
832-
deferred.resolve(fallbackPath);
833-
})
834-
.fail(function () {
835-
// Last resort is Brackets source folder which is guaranteed to exist
836-
deferred.resolve(FileUtils.getNativeBracketsDirectoryPath());
837-
});
838-
839-
return deferred.promise();
840-
}
841-
842795
/**
843796
* @deprecated use getStartupProjectPath instead. Can be removed anytime after 2-Apr-2023.
844797
* Initial project path is stored in prefs, which defaults to the welcome project on
@@ -1251,17 +1204,11 @@ define(function (require, exports, module) {
12511204
// which is now partially torn down (see #6574).
12521205
model.projectRoot = null;
12531206

1254-
// The project folder stored in preference doesn't exist, so load the default
1255-
// project directory.
1256-
// TODO (issue #267): When Brackets supports having no project directory
1257-
// defined this code will need to change
1258-
_getFallbackProjectPath().done(function (path) {
1259-
_loadProject(path).always(function () {
1260-
// Make sure not to reject the original deferred until the fallback
1261-
// project is loaded, so we don't violate expectations that there is always
1262-
// a current project before continuing after _loadProject().
1263-
result.reject();
1264-
});
1207+
_loadProject(getWelcomeProjectPath()).always(function () {
1208+
// Make sure not to reject the original deferred until the fallback
1209+
// project is loaded, so we don't violate expectations that there is always
1210+
// a current project before continuing after _loadProject().
1211+
result.reject();
12651212
});
12661213
});
12671214
}

0 commit comments

Comments
 (0)