diff options
Diffstat (limited to 'js/io')
-rwxr-xr-x | js/io/system/coreioapi.js | 21 | ||||
-rw-r--r-- | js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js | 2 | ||||
-rw-r--r-- | js/io/ui/save-as-dialog.reel/save-as-dialog.js | 2 |
3 files changed, 23 insertions, 2 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index f4ab56b6..f0ca568f 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js | |||
@@ -983,6 +983,27 @@ exports.CoreIoApi = Montage.create(Component, { | |||
983 | return retValue; | 983 | return retValue; |
984 | } | 984 | } |
985 | }, | 985 | }, |
986 | |||
987 | /*** | ||
988 | * checks for valid uri pattern | ||
989 | * also flags if Windows uri pattern and Unix uri patterns are mixed | ||
990 | */ | ||
991 | isValidUri:{ | ||
992 | value: function(uri){ | ||
993 | var isWindowsUri=false, isUnixUri=false,status=false; | ||
994 | if(uri !== ""){ | ||
995 | uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces | ||
996 | |||
997 | //for local machine folder uri | ||
998 | isWindowsUri = /^([a-zA-Z]:)(\\[^<>:"/\\|?*]+)*\\?$/gi.test(uri); | ||
999 | isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix | ||
1000 | status = isWindowsUri || isUnixUri; | ||
1001 | if(isWindowsUri && isUnixUri){status = false;} | ||
1002 | } | ||
1003 | return status; | ||
1004 | } | ||
1005 | }, | ||
1006 | |||
986 | //////////////////////////////////////////////////////////////////// | 1007 | //////////////////////////////////////////////////////////////////// |
987 | /*** | 1008 | /*** |
988 | * check if the file exists | 1009 | * check if the file exists |
diff --git a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js index cee8d4b7..a747b8de 100644 --- a/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js +++ b/js/io/ui/new-file-dialog/new-file-options-navigator.reel/new-file-options-navigator.js | |||
@@ -335,7 +335,7 @@ var NewFileOptionsNavigator = exports.NewFileOptionsNavigator = Montage.create(C | |||
335 | 335 | ||
336 | isValidUri:{ | 336 | isValidUri:{ |
337 | value: function(uri){ | 337 | value: function(uri){ |
338 | var status= nj.isValidUri(uri); | 338 | var status= this.application.ninja.coreIoApi.isValidUri(uri); |
339 | if(uri !== ""){ | 339 | if(uri !== ""){ |
340 | if(!status){ | 340 | if(!status){ |
341 | this.showError("! Invalid directory."); | 341 | this.showError("! Invalid directory."); |
diff --git a/js/io/ui/save-as-dialog.reel/save-as-dialog.js b/js/io/ui/save-as-dialog.reel/save-as-dialog.js index 371aa9a7..b20bed87 100644 --- a/js/io/ui/save-as-dialog.reel/save-as-dialog.js +++ b/js/io/ui/save-as-dialog.reel/save-as-dialog.js | |||
@@ -152,7 +152,7 @@ var SaveAsDialog = exports.SaveAsDialog = Montage.create(Component, { | |||
152 | 152 | ||
153 | isValidUri:{ | 153 | isValidUri:{ |
154 | value: function(uri){ | 154 | value: function(uri){ |
155 | var status= nj.isValidUri(uri); | 155 | var status= this.application.ninja.coreIoApi.isValidUri(uri); |
156 | if(uri !== ""){ | 156 | if(uri !== ""){ |
157 | if(!status){ | 157 | if(!status){ |
158 | this.showError("! Invalid directory."); | 158 | this.showError("! Invalid directory."); |