diff options
Diffstat (limited to 'js/io/system')
-rwxr-xr-x | js/io/system/coreioapi.js | 21 |
1 files changed, 21 insertions, 0 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 |