diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js
index 9043d3331fe..c09cda4fc9e 100644
--- a/src/nls/root/strings.js
+++ b/src/nls/root/strings.js
@@ -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",
@@ -55,11 +57,11 @@ define({
"ERROR_RENAMING_FILE" : "An error occurred when trying to rename the file {0}. {1}",
"ERROR_DELETING_FILE_TITLE" : "Error deleting file",
"ERROR_DELETING_FILE" : "An error occurred when trying to delete the file {0}. {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 {0} already exists.",
- "ERROR_CREATING_FILE_TITLE" : "Error creating file",
- "ERROR_CREATING_FILE" : "An error occurred when trying to create the file {0}. {1}",
+ "FILE_ALREADY_EXISTS" : "The {0} {1} already exists.",
+ "ERROR_CREATING_FILE_TITLE" : "Error creating {0}",
+ "ERROR_CREATING_FILE" : "An error occurred when trying to create the {0} {1}. {2}",
// Application error strings
"ERROR_IN_BROWSER_TITLE" : "Oops! {APP_NAME} doesn't run in browsers yet.",
diff --git a/src/project/ProjectManager.js b/src/project/ProjectManager.js
index 0203b3eb7da..873447831b6 100644
--- a/src/project/ProjectManager.js
+++ b/src/project/ProjectManager.js
@@ -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 ?
@@ -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)
);
}