From 68bc4f9bdaec33936e30dadbf45cc68598772eee Mon Sep 17 00:00:00 2001 From: Jeff Booher Date: Mon, 5 May 2014 11:17:36 -0700 Subject: [PATCH 1/3] update regex --- src/project/ProjectManager.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/project/ProjectManager.js b/src/project/ProjectManager.js index 4c45a72181d..82dc3fd3eb6 100644 --- a/src/project/ProjectManager.js +++ b/src/project/ProjectManager.js @@ -185,7 +185,8 @@ define(function (require, exports, module) { * RegEx to validate if a filename is not allowed even if the system allows it. * This is done to prevent cross-platform issues. */ - var _illegalFilenamesRegEx = /^(\.+|com[1-9]|lpt[1-9]|nul|con|prn|aux)$/i; + + var _illegalFilenamesRegEx = /^(\.+|com[1-9]|lpt[1-9]|nul|con|prn|aux|)$|\.+$/i; var suppressToggleOpen = false; From baa4ab0c3a573b6dada7a400f7c94ce3de4dc61b Mon Sep 17 00:00:00 2001 From: Jeff Booher Date: Wed, 7 May 2014 11:31:10 -0700 Subject: [PATCH 2/3] disallow trailing dots in file/directory names, rework error messages, remove unused strings --- src/nls/root/strings.js | 11 ++++++++--- src/project/ProjectManager.js | 14 ++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index 0e1774f2389..774ad58f031 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -40,6 +40,11 @@ define({ "FILE_EXISTS_ERR" : "The file or directory already exists.", "FILE" : "file", "DIRECTORY" : "directory", + "DIRECTORY_NAMES_LEDE" : "Directory names", + "FILENAMES_LEDE" : "Filenames", + "FILENAME" : "filename", + "DIRECTORY_NAME" : "directory name", + // Project error strings "ERROR_LOADING_PROJECT" : "Error loading project", @@ -59,9 +64,9 @@ 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 {0} name", - "INVALID_FILENAME_MESSAGE" : "Filenames cannot contain the following characters: {0} or use any system reserved words.", - "FILE_ALREADY_EXISTS" : "The {0} {1} already exists.", + "INVALID_FILENAME_TITLE" : "Invalid {0}", + "INVALID_FILENAME_MESSAGE" : "{0} cannot contain the following characters: {1}, use any system reserved words or end with dots (.).", + "ENTRY_WITH_SAME_NAME_EXISTS" : "A file or directory with the name {0} already exists.", "ERROR_CREATING_FILE_TITLE" : "Error creating {0}", "ERROR_CREATING_FILE" : "An error occurred when trying to create the {0} {1}. {2}", diff --git a/src/project/ProjectManager.js b/src/project/ProjectManager.js index 82dc3fd3eb6..ebfcc88ffa5 100644 --- a/src/project/ProjectManager.js +++ b/src/project/ProjectManager.js @@ -1530,8 +1530,8 @@ define(function (require, exports, module) { filename.match(_illegalFilenamesRegEx)) { Dialogs.showModalDialog( DefaultDialogs.DIALOG_ID_ERROR, - StringUtils.format(Strings.INVALID_FILENAME_TITLE, isFolder ? Strings.DIRECTORY : Strings.FILE), - StringUtils.format(Strings.INVALID_FILENAME_MESSAGE, _invalidChars) + StringUtils.format(Strings.INVALID_FILENAME_TITLE, isFolder ? Strings.DIRECTORY_NAME : Strings.FILENAME), + StringUtils.format(Strings.INVALID_FILENAME_MESSAGE, isFolder ? Strings.DIRECTORY_NAMES_LEDE : Strings.FILENAMES_LEDE, _invalidChars) ); return false; } @@ -1658,15 +1658,13 @@ define(function (require, exports, module) { }; var errorCallback = function (error, entry) { - var entryType = isFolder ? Strings.DIRECTORY : Strings.FILE, - oppositeEntryType = isFolder ? Strings.FILE : Strings.DIRECTORY; + var titleType = isFolder ? Strings.DIRECTORY_NAME : Strings.FILENAME, + entryType = isFolder ? Strings.DIRECTORY : Strings.FILE; if (error === FileSystemError.ALREADY_EXISTS) { - var useOppositeType = (isFolder === entry.isFile); Dialogs.showModalDialog( DefaultDialogs.DIALOG_ID_ERROR, - StringUtils.format(Strings.INVALID_FILENAME_TITLE, entryType), - StringUtils.format(Strings.FILE_ALREADY_EXISTS, - useOppositeType ? oppositeEntryType : entryType, + StringUtils.format(Strings.INVALID_FILENAME_TITLE, titleType), + StringUtils.format(Strings.ENTRY_WITH_SAME_NAME_EXISTS, StringUtils.breakableUrl(data.rslt.name)) ); } else { From 631c7ca519c2eebf613e760f98b4e0fc866113ca Mon Sep 17 00:00:00 2001 From: Jeff Booher Date: Wed, 14 May 2014 19:00:56 -0700 Subject: [PATCH 3/3] fix lint error, rearrange error message and emphasize invalid characters --- src/nls/root/strings.js | 2 +- src/project/ProjectManager.js | 2 +- src/styles/brackets.less | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/nls/root/strings.js b/src/nls/root/strings.js index 774ad58f031..34b72157007 100644 --- a/src/nls/root/strings.js +++ b/src/nls/root/strings.js @@ -65,7 +65,7 @@ define({ "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 {0}", - "INVALID_FILENAME_MESSAGE" : "{0} cannot contain the following characters: {1}, use any system reserved words or end with dots (.).", + "INVALID_FILENAME_MESSAGE" : "{0} cannot use any system reserved words, end with dots (.) or use any of the following characters: {1}", "ENTRY_WITH_SAME_NAME_EXISTS" : "A file or directory with the name {0} already exists.", "ERROR_CREATING_FILE_TITLE" : "Error creating {0}", "ERROR_CREATING_FILE" : "An error occurred when trying to create the {0} {1}. {2}", diff --git a/src/project/ProjectManager.js b/src/project/ProjectManager.js index ebfcc88ffa5..8d18075fdeb 100644 --- a/src/project/ProjectManager.js +++ b/src/project/ProjectManager.js @@ -1664,7 +1664,7 @@ define(function (require, exports, module) { Dialogs.showModalDialog( DefaultDialogs.DIALOG_ID_ERROR, StringUtils.format(Strings.INVALID_FILENAME_TITLE, titleType), - StringUtils.format(Strings.ENTRY_WITH_SAME_NAME_EXISTS, + StringUtils.format(Strings.ENTRY_WITH_SAME_NAME_EXISTS, StringUtils.breakableUrl(data.rslt.name)) ); } else { diff --git a/src/styles/brackets.less b/src/styles/brackets.less index 3093d4a62a2..3adf0196985 100644 --- a/src/styles/brackets.less +++ b/src/styles/brackets.less @@ -1551,3 +1551,8 @@ label input { transform: scale(1); } } + +.emphasized { + font-weight: 900; + font-size: 1.01em; +} \ No newline at end of file