-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Directory creation error #4244
Directory creation error #4244
Changes from 7 commits
53ed7ee
33e01f3
6731218
29cd68d
e17c0a7
de84314
988e637
0f26eba
b87a928
ca269fa
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 |
---|---|---|
|
@@ -1227,15 +1227,14 @@ define(function (require, exports, module) { | |
}; | ||
|
||
var errorCallback = function (error) { | ||
var errorString = isFolder ? Strings.DIRECTORY : Strings.FILE; | ||
if ((error.name === NativeFileError.PATH_EXISTS_ERR) || | ||
(error.name === NativeFileError.TYPE_MISMATCH_ERR)) { | ||
Dialogs.showModalDialog( | ||
DefaultDialogs.DIALOG_ID_ERROR, | ||
Strings.INVALID_FILENAME_TITLE, | ||
StringUtils.format( | ||
Strings.FILE_ALREADY_EXISTS, | ||
StringUtils.breakableUrl(data.rslt.name) | ||
) | ||
StringUtils.format(Strings.FILE_ALREADY_EXISTS_TILE, errorString), | ||
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. Shouldn't this be 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. Oops. You are right. 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. One other small Nit: |
||
StringUtils.format(Strings.FILE_ALREADY_EXISTS, errorString, | ||
StringUtils.breakableUrl(data.rst.name)) | ||
); | ||
} else { | ||
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. At this else branch there is another error dialog that always display "File" in the strings as the code fixed. Maybe this could be fixed here too. |
||
var errString = error.name === NativeFileError.NO_MODIFICATION_ALLOWED_ERR ? | ||
|
@@ -1244,12 +1243,9 @@ define(function (require, exports, module) { | |
|
||
Dialogs.showModalDialog( | ||
DefaultDialogs.DIALOG_ID_ERROR, | ||
Strings.ERROR_CREATING_FILE_TITLE, | ||
StringUtils.format( | ||
Strings.ERROR_CREATING_FILE, | ||
StringUtils.breakableUrl(data.rslt.name), | ||
errString | ||
) | ||
StringUtils.format(Strings.ERROR_CREATING_FILE_TITLE, errorString), | ||
StringUtils.format(Strings.ERROR_CREATING_FILE, errorString, | ||
Strings.breakableUrl(data.rslt.name), errString) | ||
); | ||
} | ||
|
||
|
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.
Almost. I went back to the original bug to test and found some more issues not mentioned.
If you create a file with a name
foo
, the try to create a directory of the same name, you get "The directory foo already exists" instead of "The file foo already exists"...and vice versa.You can split the
if
here with anelse if
branch to handleTYPE_MISMATCH_ERR
separate fromPATH_EXISTS_ERROR
, that should fix it.