diff options
author | Jose Antonio Marquez | 2012-02-07 23:13:15 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-07 23:13:15 -0800 |
commit | 687cfbbae1df2392267e9602f955f6eadd5b339d (patch) | |
tree | 6b3a1a0f241bcf42df5d68fdb60af865c99ec9c4 /js/io/system/ninjalibrary.js | |
parent | af58afcffff5ac556d16f050a325ac0406897fcd (diff) | |
download | ninja-687cfbbae1df2392267e9602f955f6eadd5b339d.tar.gz |
Mime type fixes
Trying to fix mime type issues in FileSystem, Chrome does not support reponseType 'blob', so looking at alternatives.
Diffstat (limited to 'js/io/system/ninjalibrary.js')
-rw-r--r-- | js/io/system/ninjalibrary.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js index 0ab19401..3914ec29 100644 --- a/js/io/system/ninjalibrary.js +++ b/js/io/system/ninjalibrary.js | |||
@@ -74,7 +74,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
74 | //Getting contents of library to be copied | 74 | //Getting contents of library to be copied |
75 | this.chromeApi.directoryContents(contents[i], function (lib) { | 75 | this.chromeApi.directoryContents(contents[i], function (lib) { |
76 | //Creating directory structure from subfolders | 76 | //Creating directory structure from subfolders |
77 | this.copyDirectoryToCloud(path, contents[i], function (status) {console.log(status)}); | 77 | this.copyDirectoryToCloud(path, contents[i], '/'+path, function (status) {console.log(status)}); |
78 | }.bind(this)); | 78 | }.bind(this)); |
79 | break; | 79 | break; |
80 | } | 80 | } |
@@ -89,7 +89,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
89 | // | 89 | // |
90 | copyDirectoryToCloud: { | 90 | copyDirectoryToCloud: { |
91 | enumerable: true, | 91 | enumerable: true, |
92 | value: function(root, folder, callback) { | 92 | value: function(root, folder, fileRoot, callback) { |
93 | // | ||
93 | if (folder.name) { | 94 | if (folder.name) { |
94 | var dir; | 95 | var dir; |
95 | if (root) { | 96 | if (root) { |
@@ -108,9 +109,14 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
108 | this.chromeApi.directoryContents(folder, function (contents) { | 109 | this.chromeApi.directoryContents(folder, function (contents) { |
109 | for (var i in contents) { | 110 | for (var i in contents) { |
110 | if (contents[i].isDirectory) { | 111 | if (contents[i].isDirectory) { |
111 | this.copyDirectoryToCloud(dir, contents[i]); | 112 | this.copyDirectoryToCloud(dir, contents[i], fileRoot); |
112 | } else if (contents[i].isFile){ | 113 | } else if (contents[i].isFile){ |
113 | //File to copy | 114 | //File to copy |
115 | this.chromeApi.fileContent(contents[i].fullPath, function (result) { | ||
116 | // | ||
117 | this.coreApi.createFile({uri: fileRoot+result.file.fullPath, contents: result.content, contentType: result.data.type}); | ||
118 | //this.coreApi.createFile({uri: fileRoot+result.file.fullPath, contents: result.content}); | ||
119 | }.bind(this)); | ||
114 | } | 120 | } |
115 | } | 121 | } |
116 | }.bind(this)); | 122 | }.bind(this)); |
@@ -185,7 +191,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
185 | //Checking for status | 191 | //Checking for status |
186 | if (xhr.readyState === 4) { //TODO: add check for mime type | 192 | if (xhr.readyState === 4) { //TODO: add check for mime type |
187 | //Creating new file from loaded content | 193 | //Creating new file from loaded content |
188 | this.chromeApi.fileNew('/'+tocopylibs[i].name+'/'+tocopylibs[i].file, xhr.response, function (status) {if(status) this.libraryCopied()}.bind(this)); | 194 | //this.chromeApi.fileNew('/'+tocopylibs[i].name+'/'+tocopylibs[i].file, xhr.response, function (status) {if(status) this.libraryCopied()}.bind(this)); |
189 | } else { | 195 | } else { |
190 | //Error creating single file library | 196 | //Error creating single file library |
191 | } | 197 | } |