From 137aef56fdd9e645f4a3d7e32dc1101171932a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Malbr=C3=A1n?= Date: Wed, 17 Jul 2013 02:59:43 -0300 Subject: [PATCH 1/2] Replace the title's {0} with 'File' or 'Directory' in the illegal characters message --- src/project/ProjectManager.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/project/ProjectManager.js b/src/project/ProjectManager.js index 0a648c9b031..d755dc10127 100644 --- a/src/project/ProjectManager.js +++ b/src/project/ProjectManager.js @@ -1098,18 +1098,20 @@ define(function (require, exports, module) { /** * @private - * * Check a filename for illegal characters. If any are found, show an error * dialog and return false. If no illegal characters are found, return true. + * @param {string} filename + * @param {boolean} isFolder + * @return {boolean} True if the filename has illegal characters */ - function _checkForValidFilename(filename) { + function _checkForValidFilename(filename, isFolder) { // Validate file name // Checks for valid Windows filenames: // See http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx if ((filename.search(/[\/?*:;\{\}<>\\|]+/) !== -1) || filename.match(_illegalFilenamesRegEx)) { Dialogs.showModalDialog( DefaultDialogs.DIALOG_ID_ERROR, - Strings.INVALID_FILENAME_TITLE, + StringUtils.format(Strings.INVALID_FILENAME_TITLE, isFolder ? Strings.DIRECTORY : Strings.FILE), Strings.INVALID_FILENAME_MESSAGE ); return false; @@ -1194,7 +1196,7 @@ define(function (require, exports, module) { if (!escapeKeyPressed) { // Validate file name - if (!_checkForValidFilename(data.rslt.name)) { + if (!_checkForValidFilename(data.rslt.name, isFolder)) { errorCleanup(); return; } @@ -1418,7 +1420,7 @@ define(function (require, exports, module) { _projectTree.jstree("sort", selected.parent()); }; - if (!changed || !_checkForValidFilename(data.rslt.new_name)) { + if (!changed || !_checkForValidFilename(data.rslt.new_name, isFolder)) { // No change or invalid filename. Reset the old name and bail. _resetOldFilename(); return; From 4d3d6ce0ca1efaee82e3c847548fc1e80612692b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Malbr=C3=A1n?= Date: Wed, 17 Jul 2013 17:18:09 -0300 Subject: [PATCH 2/2] Type fixed on the return description --- src/project/ProjectManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project/ProjectManager.js b/src/project/ProjectManager.js index d755dc10127..4035fa92671 100644 --- a/src/project/ProjectManager.js +++ b/src/project/ProjectManager.js @@ -1102,7 +1102,7 @@ define(function (require, exports, module) { * dialog and return false. If no illegal characters are found, return true. * @param {string} filename * @param {boolean} isFolder - * @return {boolean} True if the filename has illegal characters + * @return {boolean} Returns true if no illegal characters are found */ function _checkForValidFilename(filename, isFolder) { // Validate file name