From 59e40a90d5d8f2167c1c089b464082985106dd23 Mon Sep 17 00:00:00 2001 From: Randy Edmunds Date: Fri, 29 Jun 2012 14:11:28 -0700 Subject: [PATCH] when file not found, remove it from working set --- src/document/DocumentCommandHandlers.js | 2 ++ src/document/DocumentManager.js | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/document/DocumentCommandHandlers.js b/src/document/DocumentCommandHandlers.js index 66cbf6526bb..c2de536b028 100644 --- a/src/document/DocumentCommandHandlers.js +++ b/src/document/DocumentCommandHandlers.js @@ -151,6 +151,8 @@ define(function (require, exports, module) { }) .fail(function (fileError) { FileUtils.showFileOpenError(fileError.code, fullPath).done(function () { + // For performance, we do lazy checking of file existence, so it may be in working set + DocumentManager.removeFromWorkingSet(new NativeFileSystem.FileEntry(fullPath)); EditorManager.focusEditor(); result.reject(); }); diff --git a/src/document/DocumentManager.js b/src/document/DocumentManager.js index aa7c1aa2d8d..9a0224caec2 100644 --- a/src/document/DocumentManager.js +++ b/src/document/DocumentManager.js @@ -258,7 +258,7 @@ define(function (require, exports, module) { * the current editor even if it's for this file. * @param {!FileEntry} file */ - function _removeFromWorkingSet(file) { + function removeFromWorkingSet(file) { // If doc isn't in working set, do nothing var index = findInWorkingSet(file.fullPath); if (index === -1) { @@ -420,10 +420,10 @@ define(function (require, exports, module) { // Remove closed doc from working set, if it was in there // This happens regardless of whether the document being closed was the current one or not - _removeFromWorkingSet(file); + removeFromWorkingSet(file); // Note: EditorManager will dispose the closed document's now-unneeded editor either in - // response to the editor-swap call above, or the _removeFromWorkingSet() call, depending on + // response to the editor-swap call above, or the removeFromWorkingSet() call, depending on // circumstances. See notes in EditorManager for more. } @@ -1034,6 +1034,7 @@ define(function (require, exports, module) { exports.setCurrentDocument = setCurrentDocument; exports.addToWorkingSet = addToWorkingSet; exports.addListToWorkingSet = addListToWorkingSet; + exports.removeFromWorkingSet = removeFromWorkingSet; exports.getNextPrevFile = getNextPrevFile; exports.beginDocumentNavigation = beginDocumentNavigation; exports.finalizeDocumentNavigation = finalizeDocumentNavigation;