aboutsummaryrefslogtreecommitdiff
path: root/js/io
diff options
context:
space:
mode:
Diffstat (limited to 'js/io')
-rwxr-xr-xjs/io/system/coreioapi.js3
-rwxr-xr-xjs/io/system/fileio.js17
2 files changed, 10 insertions, 10 deletions
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js
index bdba5240..d9505cd6 100755
--- a/js/io/system/coreioapi.js
+++ b/js/io/system/coreioapi.js
@@ -92,6 +92,9 @@ exports.CoreIoApi = Montage.create(Component, {
92 //TODO: Remove test 92 //TODO: Remove test
93 //this.ninjaLibrary.copyLibToCloud('Users/kgq387/Desktop/Ninja Cloud/Disk', 'montage0.6.0'); 93 //this.ninjaLibrary.copyLibToCloud('Users/kgq387/Desktop/Ninja Cloud/Disk', 'montage0.6.0');
94 //this.ninjaLibrary.deleteLibraries(); 94 //this.ninjaLibrary.deleteLibraries();
95 window.hack = function (name, type) {
96 this.application.ninja.ioMediator.fileNew('Users/kgq387/Desktop/Ninja Cloud/Disk/'+name+'.'+type, '/js/io/templates/files/'+type+'.txt', function (status) {console.log(status)});
97 }.bind(this);
95 } 98 }
96 }, 99 },
97 //////////////////////////////////////////////////////////////////// 100 ////////////////////////////////////////////////////////////////////
diff --git a/js/io/system/fileio.js b/js/io/system/fileio.js
index 23186cf2..7bf4d41f 100755
--- a/js/io/system/fileio.js
+++ b/js/io/system/fileio.js
@@ -17,15 +17,13 @@ NOTES:
17//////////////////////////////////////////////////////////////////////// 17////////////////////////////////////////////////////////////////////////
18///////////////////////////////////////////////////////////////////// */ 18///////////////////////////////////////////////////////////////////// */
19// 19//
20var Montage = require("montage/core/core").Montage; 20var Montage = require("montage/core/core").Montage,
21 Component = require("montage/ui/component").Component;
21//////////////////////////////////////////////////////////////////////// 22////////////////////////////////////////////////////////////////////////
22//Exporting as File I/O 23//Exporting as File I/O
23exports.FileIo = Montage.create(require("montage/ui/component").Component, { 24exports.FileIo = Montage.create(Component, {
24 //////////////////////////////////////////////////////////////////// 25 ////////////////////////////////////////////////////////////////////
25 //newFile Object (*required): {uri*, contents, contentType} 26 //newFile Object (*required): {uri*, contents, contentType}
26 //Return codes
27 // 204: File exists | 400: File exists | 404: File does not exists
28 // 201: File succesfully created | 500: Unknown | undefined: Unknown
29 newFile: { 27 newFile: {
30 enumerable: true, 28 enumerable: true,
31 value: function(file) { 29 value: function(file) {
@@ -35,7 +33,7 @@ exports.FileIo = Montage.create(require("montage/ui/component").Component, {
35 return null; 33 return null;
36 } 34 }
37 //Peforming check for file to exist 35 //Peforming check for file to exist
38 var check = this.application.ninja.coreIoApi.fileExists(file.uri), status, create; 36 var check = this.application.ninja.coreIoApi.fileExists({uri: file.uri}), status, create;
39 //Upon successful check, handling results 37 //Upon successful check, handling results
40 if (check.success) { 38 if (check.success) {
41 //Handling status of check 39 //Handling status of check
@@ -47,10 +45,7 @@ exports.FileIo = Montage.create(require("montage/ui/component").Component, {
47 case 404: 45 case 404:
48 //File does not exists, ready to be created 46 //File does not exists, ready to be created
49 create = this.application.ninja.coreIoApi.createFile(file); 47 create = this.application.ninja.coreIoApi.createFile(file);
50 //Storing status to be returned (for UI handling) 48 status = create.status;
51 if (create.success) {
52 status = check.status;
53 }
54 break; 49 break;
55 default: 50 default:
56 //Unknown Error 51 //Unknown Error
@@ -61,6 +56,8 @@ exports.FileIo = Montage.create(require("montage/ui/component").Component, {
61 } 56 }
62 //Returning resulting code 57 //Returning resulting code
63 return status; 58 return status;
59 // 204: File exists | 400: File exists | 404: File does not exists
60 // 201: File succesfully created | 500: Unknown | undefined: Unknown
64 } 61 }
65 }, 62 },
66 //////////////////////////////////////////////////////////////////// 63 ////////////////////////////////////////////////////////////////////