aboutsummaryrefslogtreecommitdiff
path: root/js/lib/NJUtils.js
diff options
context:
space:
mode:
authorEric Guzman2012-02-16 00:22:43 -0800
committerEric Guzman2012-02-16 00:22:43 -0800
commit82b1a273219f0ae3d119e156c7acccdbe478f441 (patch)
tree74c45e5e3afc6706b2f7a7918807f72c54cdcfc5 /js/lib/NJUtils.js
parentaf20ca9b11133dd5cefb9275dbe8fb101c3380d0 (diff)
parent966f0adaf1d4b7f2dd5a6e31643df58bff713884 (diff)
downloadninja-82b1a273219f0ae3d119e156c7acccdbe478f441.tar.gz
Merge branch 'refs/heads/TreeComponents' into PresetsPanel
Diffstat (limited to 'js/lib/NJUtils.js')
-rwxr-xr-x[-rw-r--r--]js/lib/NJUtils.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js
index 0e886ae7..8daafa42 100644..100755
--- a/js/lib/NJUtils.js
+++ b/js/lib/NJUtils.js
@@ -227,8 +227,26 @@ exports.NJUtils = Object.create(Object.prototype, {
227 ///// Return the last part of a path (e.g. filename) 227 ///// Return the last part of a path (e.g. filename)
228 getFileNameFromPath : { 228 getFileNameFromPath : {
229 value: function(path) { 229 value: function(path) {
230 path = path.replace(/[/\\]$/g,"");
231 path = path.replace(/\\/g,"/");
230 return path.substr(path.lastIndexOf('/') + 1); 232 return path.substr(path.lastIndexOf('/') + 1);
231 } 233 }
234 },
235 /***
236 * file name validation
237 */
238 isValidFileName:{
239 value: function(fileName){
240 var status = false;
241 if(fileName !== ""){
242 fileName = fileName.replace(/^\s+|\s+$/g,"");
243 status = !(/[/\\]/g.test(fileName));
244 if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden
245 status = !(/^\./g.test(fileName));
246 }
247 }
248 return status;
249 }
232 } 250 }
233 251
234}); 252});