From 0e595c4e11ce9b44eff157de8616ed15fcd5d6fc Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 2 Feb 2012 12:37:29 -0800 Subject: refactoring some file names and locations, change made to maintain only one codemirror div. Signed-off-by: Ananya Sen --- js/io/utils/file-utils.js | 76 ----------------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 js/io/utils/file-utils.js (limited to 'js/io/utils/file-utils.js') diff --git a/js/io/utils/file-utils.js b/js/io/utils/file-utils.js deleted file mode 100644 index 784ecf59..00000000 --- a/js/io/utils/file-utils.js +++ /dev/null @@ -1,76 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component; - -var FileUtils = exports.FileUtils = Montage.create(Component, { - - /*** - * checks for valid uri pattern - * also flags if Windows uri pattern and Unix uri patterns are mixed - */ - isValidUri:{ - value: function(uri){ - var isWindowsUri=false, isUnixUri=false,status=false; - if(uri !== ""){ - uri = uri.replace(/^\s+|\s+$/g,""); // strip any leading or trailing spaces - - //for local machine folder uri - isWindowsUri = /^([a-zA-Z]:)(\\[^<>:"/\\|?*]+)*\\?$/gi.test(uri); - isUnixUri = /^(\/)?(\/(?![.])[^/]*)*\/?$/gi.test(uri);//folders beginning with . are hidden on Mac / Unix - status = isWindowsUri || isUnixUri; - if(isWindowsUri && isUnixUri){status = false;} - } - return status; - } - }, - - /*** - * file name validation - */ - isValidFileName:{ - value: function(fileName){ - var status = false; - if(fileName !== ""){ - fileName = fileName.replace(/^\s+|\s+$/g,""); - status = !(/[/\\]/g.test(fileName)); - if(status && navigator.userAgent.indexOf("Macintosh") != -1){//for Mac files beginning with . are hidden - status = !(/^\./g.test(fileName)); - } - } - return status; - } - }, - - /*** - * check if the file exists - */ - checkFileExists:{ - value: function(fileUri, folderUri, fileType){ - var uri = "", response=null, status=true; - - //prepare absolute uri - if(/[^/\\]$/g.test(folderUri)){ - folderUri = folderUri + "/"; - } - - //todo:add file extension check if fileType present - - uri = ""+folderUri+fileUri; - - response = this.application.ninja.coreIoApi.fileExists({"uri":uri}); - if(!!response && response.success && (response.status === 204)){ - status = true; - }else if(!!response && response.success && (response.status === 404)){ - status = false; - }else{ - status = false; - } - return status; - } - } -}); \ No newline at end of file -- cgit v1.2.3