aboutsummaryrefslogtreecommitdiff
path: root/js/io/system
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-01 13:31:56 -0800
committerJose Antonio Marquez2012-02-01 13:31:56 -0800
commitd3208408027c90696af91883935279cf4d023ddc (patch)
tree353e60c8b0cc30012dfd5a0d3573bd0055d30bd3 /js/io/system
parent54ccd309722797e79ca35fe115b0372e86850551 (diff)
parentfc4d32e0df064ecdbe7ed86aab25eeab58253032 (diff)
downloadninja-d3208408027c90696af91883935279cf4d023ddc.tar.gz
Merge branch 'refs/heads/AnanyaFileIO' into FileIO
Diffstat (limited to 'js/io/system')
-rwxr-xr-xjs/io/system/coreioapi.js45
1 files changed, 1 insertions, 44 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index 7e883b81..3a007028 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -937,50 +937,7 @@ exports.CoreIoApi = Montage.create(Component, {
937 var serviceURL = this._prepareServiceURL(this.fileServiceURL, file.uri), 937 var serviceURL = this._prepareServiceURL(this.fileServiceURL, file.uri),
938 xhr = new XMLHttpRequest(); 938 xhr = new XMLHttpRequest();
939 xhr.open("GET", serviceURL, false); 939 xhr.open("GET", serviceURL, false);
940 xhr.setRequestHeader("get-attributes", "true"); 940 xhr.setRequestHeader("get-file-info", "true");
941 xhr.send();
942 if (xhr.readyState === 4) {
943 retValue.status = xhr.status;
944 if(xhr.status == 200) {
945 retValue.content = xhr.responseText;
946 }
947 retValue.success = true;
948 }
949 }
950 catch(error) {
951 xhr = null;
952 retValue.success = false;
953 }
954 }
955 return retValue;
956 }
957 },
958
959 ////////////////////////////////////////////////////////////////////
960 // Checks if the directory is writable
961 // Parameters:
962 // the file parameter must contain the following properties
963 // uri: string value containing the full directory path/URI i.e. "c:/foo"
964 //
965 // Return values:
966 // returns an object with two properties
967 // success: boolean indicating if the call succeeded or failed
968 // status: int indicating the request HTTP status code
969 // 204 - The file exists and response body has writable flag
970 // 404 - the file does not exist
971 // 500 - unknown server error occurred
972 //TODO:to be finalized
973 isDirectoryWritable:{
974 enumerable:true,
975 writable:false,
976 value:function(file){
977 var retValue = { success:null, status:null };
978 if(file && file.uri) {
979 try {
980 var serviceURL = this._prepareServiceURL(this.directoryServiceURL, file.uri),
981 xhr = new XMLHttpRequest();
982 xhr.open("GET", serviceURL, false);
983 xhr.setRequestHeader("get-attributes", "true");
984 xhr.send(); 941 xhr.send();
985 if (xhr.readyState === 4) { 942 if (xhr.readyState === 4) {
986 retValue.status = xhr.status; 943 retValue.status = xhr.status;