Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
when file not found, remove it from working set
Browse files Browse the repository at this point in the history
  • Loading branch information
redmunds committed Jun 29, 2012
1 parent a29eba1 commit 59e40a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
7 changes: 4 additions & 3 deletions src/document/DocumentManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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.
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 59e40a9

Please sign in to comment.