-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Fix for dropping projects when cancelling switch (#1780) #2013
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,8 @@ define(function (require, exports, module) { | |
SidebarView = brackets.getModule("project/SidebarView"), | ||
Menus = brackets.getModule("command/Menus"), | ||
PopUpManager = brackets.getModule("widgets/PopUpManager"), | ||
FileUtils = brackets.getModule("file/FileUtils"); | ||
FileUtils = brackets.getModule("file/FileUtils"), | ||
NativeFileSystem = brackets.getModule("file/NativeFileSystem").NativeFileSystem; | ||
|
||
var $dropdownToggle; | ||
var MAX_PROJECTS = 20; | ||
|
@@ -148,7 +149,11 @@ define(function (require, exports, module) { | |
// Remove the project from the list. | ||
var index = recentProjects.indexOf(root); | ||
if (index !== -1) { | ||
recentProjects.splice(index, 1); | ||
NativeFileSystem.requestNativeFileSystem(root, | ||
function () {}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need to define an empty function here. Use null instead. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using null shows a console error "object is not a function" in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I missed that. Keep it like it is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI, it looks like the success callback is not nullable/optional according to the W3C spec, so we currently have the "correct" behavior in NativeFileSystem. Seems a little annoying from an API design point of view, but we want to stick with the spec. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @njx Thanks for the info! It somehow felt that it'd be safer to have nullable parameters to avoid possible errors. However, it also feels strange to "request a file system" and not wanting to do anything with it :) |
||
function () { | ||
recentProjects.splice(index, 1); | ||
}); | ||
} | ||
}); | ||
closeDropdown(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update this comment to something like:
// If folder does not exist on disk then remove the project from the list