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/system/coreioapi.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'js/io/system') diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index 717606b5..7839acee 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js @@ -983,8 +983,35 @@ exports.CoreIoApi = Montage.create(Component, { // return retValue; } - } + }, //////////////////////////////////////////////////////////////////// + /*** + * 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.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; + } + } //////////////////////////////////////////////////////////////////// }); //////////////////////////////////////////////////////////////////////// -- cgit v1.2.3