diff options
Diffstat (limited to 'js/io/system')
-rwxr-xr-x | js/io/system/coreioapi.js | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index 33c7bc28..5deeae73 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js | |||
@@ -134,6 +134,9 @@ exports.CoreIoApi = Montage.create(Component, { | |||
134 | directoryServiceURL: { | 134 | directoryServiceURL: { |
135 | enumerable: false, | 135 | enumerable: false, |
136 | get: function() { | 136 | get: function() { |
137 | if(!this.rootUrl){ | ||
138 | this.rootUrl = 'http://localhost:16380'; | ||
139 | } | ||
137 | return String(this.rootUrl+this._directoryServiceURL); | 140 | return String(this.rootUrl+this._directoryServiceURL); |
138 | }, | 141 | }, |
139 | set: function(value) { | 142 | set: function(value) { |
@@ -863,50 +866,7 @@ exports.CoreIoApi = Montage.create(Component, { | |||
863 | var serviceURL = this._prepareServiceURL(this.fileServiceURL, file.uri), | 866 | var serviceURL = this._prepareServiceURL(this.fileServiceURL, file.uri), |
864 | xhr = new XMLHttpRequest(); | 867 | xhr = new XMLHttpRequest(); |
865 | xhr.open("GET", serviceURL, false); | 868 | xhr.open("GET", serviceURL, false); |
866 | xhr.setRequestHeader("get-attributes", "true"); | 869 | xhr.setRequestHeader("get-file-info", "true"); |
867 | xhr.send(); | ||
868 | if (xhr.readyState === 4) { | ||
869 | retValue.status = xhr.status; | ||
870 | if(xhr.status == 200) { | ||
871 | retValue.content = xhr.responseText; | ||
872 | } | ||
873 | retValue.success = true; | ||
874 | } | ||
875 | } | ||
876 | catch(error) { | ||
877 | xhr = null; | ||
878 | retValue.success = false; | ||
879 | } | ||
880 | } | ||
881 | return retValue; | ||
882 | } | ||
883 | }, | ||
884 | |||
885 | //////////////////////////////////////////////////////////////////// | ||
886 | // Checks if the directory is writable | ||
887 | // Parameters: | ||
888 | // the file parameter must contain the following properties | ||
889 | // uri: string value containing the full directory path/URI i.e. "c:/foo" | ||
890 | // | ||
891 | // Return values: | ||
892 | // returns an object with two properties | ||
893 | // success: boolean indicating if the call succeeded or failed | ||
894 | // status: int indicating the request HTTP status code | ||
895 | // 204 - The file exists and response body has writable flag | ||
896 | // 404 - the file does not exist | ||
897 | // 500 - unknown server error occurred | ||
898 | //TODO:to be finalized | ||
899 | isDirectoryWritable:{ | ||
900 | enumerable:true, | ||
901 | writable:false, | ||
902 | value:function(file){ | ||
903 | var retValue = { success:null, status:null }; | ||
904 | if(file && file.uri) { | ||
905 | try { | ||
906 | var serviceURL = this._prepareServiceURL(this.directoryServiceURL, file.uri), | ||
907 | xhr = new XMLHttpRequest(); | ||
908 | xhr.open("GET", serviceURL, false); | ||
909 | xhr.setRequestHeader("get-attributes", "true"); | ||
910 | xhr.send(); | 870 | xhr.send(); |
911 | if (xhr.readyState === 4) { | 871 | if (xhr.readyState === 4) { |
912 | retValue.status = xhr.status; | 872 | retValue.status = xhr.status; |