aboutsummaryrefslogtreecommitdiff
path: root/js/io/system
diff options
context:
space:
mode:
Diffstat (limited to 'js/io/system')
-rwxr-xr-xjs/io/system/coreioapi.js30
1 files changed, 28 insertions, 2 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index e55789c4..f4ab56b6 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -925,7 +925,6 @@ exports.CoreIoApi = Montage.create(Component, {
925 // 204 - The file exists and response body has writable flag 925 // 204 - The file exists and response body has writable flag
926 // 404 - the file does not exist 926 // 404 - the file does not exist
927 // 500 - unknown server error occurred 927 // 500 - unknown server error occurred
928 //TODO:to be finalized
929 isFileWritable:{ 928 isFileWritable:{
930 enumerable:true, 929 enumerable:true,
931 writable:false, 930 writable:false,
@@ -983,8 +982,35 @@ exports.CoreIoApi = Montage.create(Component, {
983 // 982 //
984 return retValue; 983 return retValue;
985 } 984 }
986 } 985 },
987 //////////////////////////////////////////////////////////////////// 986 ////////////////////////////////////////////////////////////////////
987 /***
988 * check if the file exists
989 */
990 checkFileExists:{
991 value: function(fileUri, folderUri, fileType){
992 var uri = "", response=null, status=true;
993
994 //prepare absolute uri
995 if(/[^/\\]$/g.test(folderUri)){
996 folderUri = folderUri + "/";
997 }
998
999 //todo:add file extension check if fileType present
1000
1001 uri = ""+folderUri+fileUri;
1002
1003 response = this.fileExists({"uri":uri});
1004 if(!!response && response.success && (response.status === 204)){
1005 status = true;
1006 }else if(!!response && response.success && (response.status === 404)){
1007 status = false;
1008 }else{
1009 status = false;
1010 }
1011 return status;
1012 }
1013 }
988 //////////////////////////////////////////////////////////////////// 1014 ////////////////////////////////////////////////////////////////////
989}); 1015});
990//////////////////////////////////////////////////////////////////////// 1016////////////////////////////////////////////////////////////////////////