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

Commit

Permalink
Merge pull request #4244 from DaBungalow/directory-creation-error
Browse files Browse the repository at this point in the history
Directory creation error
  • Loading branch information
jasonsanjose committed Jul 11, 2013
2 parents 39e5656 + ca269fa commit 4cf8343
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
10 changes: 6 additions & 4 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ define({
"NO_MODIFICATION_ALLOWED_ERR" : "The target directory cannot be modified.",
"NO_MODIFICATION_ALLOWED_ERR_FILE" : "The permissions do not allow you to make modifications.",
"FILE_EXISTS_ERR" : "The file or directory already exists.",
"FILE" : "file",
"DIRECTORY" : "directory",

// Project error strings
"ERROR_LOADING_PROJECT" : "Error loading project",
Expand All @@ -56,11 +58,11 @@ define({
"ERROR_RENAMING_FILE" : "An error occurred when trying to rename the file <span class='dialog-filename'>{0}</span>. {1}",
"ERROR_DELETING_FILE_TITLE" : "Error deleting file",
"ERROR_DELETING_FILE" : "An error occurred when trying to delete the file <span class='dialog-filename'>{0}</span>. {1}",
"INVALID_FILENAME_TITLE" : "Invalid file name",
"INVALID_FILENAME_TITLE" : "Invalid {0} name",
"INVALID_FILENAME_MESSAGE" : "Filenames cannot contain the following characters: /?*:;{}<>\\| or use any system reserved words.",
"FILE_ALREADY_EXISTS" : "The file <span class='dialog-filename'>{0}</span> already exists.",
"ERROR_CREATING_FILE_TITLE" : "Error creating file",
"ERROR_CREATING_FILE" : "An error occurred when trying to create the file <span class='dialog-filename'>{0}</span>. {1}",
"FILE_ALREADY_EXISTS" : "The {0} <span class='dialog-filename'>{1}</span> already exists.",
"ERROR_CREATING_FILE_TITLE" : "Error creating {0}",
"ERROR_CREATING_FILE" : "An error occurred when trying to create the {0} <span class='dialog-filename'>{1}</span>. {2}",

// Application error strings
"ERROR_IN_BROWSER_TITLE" : "Oops! {APP_NAME} doesn't run in browsers yet.",
Expand Down
29 changes: 16 additions & 13 deletions src/project/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1227,15 +1227,21 @@ define(function (require, exports, module) {
};

var errorCallback = function (error) {
if ((error.name === NativeFileError.PATH_EXISTS_ERR) ||
(error.name === NativeFileError.TYPE_MISMATCH_ERR)) {
var entryType = isFolder ? Strings.DIRECTORY : Strings.FILE,
oppositeEntryType = isFolder ? Strings.FILE : Strings.DIRECTORY;
if (error.name === NativeFileError.PATH_EXISTS_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.INVALID_FILENAME_TITLE, entryType),
StringUtils.format(Strings.FILE_ALREADY_EXISTS, entryType,
StringUtils.breakableUrl(data.rslt.name))
);
} else if (error.name === NativeFileError.TYPE_MISMATCH_ERR) {
Dialogs.showModalDialog(
DefaultDialogs.DIALOG_ID_ERROR,
StringUtils.format(Strings.INVALID_FILENAME_TITLE, entryType),
StringUtils.format(Strings.FILE_ALREADY_EXISTS, oppositeEntryType,
StringUtils.breakableUrl(data.rslt.name))
);
} else {
var errString = error.name === NativeFileError.NO_MODIFICATION_ALLOWED_ERR ?
Expand All @@ -1244,12 +1250,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, entryType),
StringUtils.format(Strings.ERROR_CREATING_FILE, entryType,
Strings.breakableUrl(data.rslt.name), errString)
);
}

Expand Down

0 comments on commit 4cf8343

Please sign in to comment.