diff options
author | Jose Antonio Marquez | 2012-02-16 11:30:33 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-16 11:30:33 -0800 |
commit | 9fe5d98bf469036c856e28d71ad4160d630b4af4 (patch) | |
tree | 930a334bcda0c26ca02eaa33a1506d147e8691e1 /js/io/system/ninjalibrary.js | |
parent | 89b5e793ea88ef235b54b6e1d1c379698d3e612b (diff) | |
parent | 71619045b692015b0889a4f5c381c1dee9c056cd (diff) | |
download | ninja-9fe5d98bf469036c856e28d71ad4160d630b4af4.tar.gz |
Merge branch 'refs/heads/NinjaInternal' into Color
Diffstat (limited to 'js/io/system/ninjalibrary.js')
-rw-r--r-- | js/io/system/ninjalibrary.js | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/js/io/system/ninjalibrary.js b/js/io/system/ninjalibrary.js index fc943323..8c58883a 100644 --- a/js/io/system/ninjalibrary.js +++ b/js/io/system/ninjalibrary.js | |||
@@ -51,6 +51,23 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
51 | }, | 51 | }, |
52 | //////////////////////////////////////////////////////////////////// | 52 | //////////////////////////////////////////////////////////////////// |
53 | // | 53 | // |
54 | _libs: { | ||
55 | enumerable: false, | ||
56 | value: null | ||
57 | }, | ||
58 | //////////////////////////////////////////////////////////////////// | ||
59 | // | ||
60 | libs: { | ||
61 | enumerable: false, | ||
62 | get: function() { | ||
63 | return this._libs; | ||
64 | }, | ||
65 | set: function(value) { | ||
66 | this._libs = value; | ||
67 | } | ||
68 | }, | ||
69 | //////////////////////////////////////////////////////////////////// | ||
70 | // | ||
54 | _libsToSync: { | 71 | _libsToSync: { |
55 | enumerable: false, | 72 | enumerable: false, |
56 | value: 0 | 73 | value: 0 |
@@ -67,14 +84,14 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
67 | enumerable: false, | 84 | enumerable: false, |
68 | value: function (path, libName) { | 85 | value: function (path, libName) { |
69 | // | 86 | // |
70 | if(this.coreApi.directoryExists({uri: '/'+path+'/'+libName+'/'}).status === 404) { | 87 | if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { |
71 | this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { | 88 | this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { |
72 | for (var i in contents) { | 89 | for (var i in contents) { |
73 | if (libName === contents[i].name) { | 90 | if (libName === contents[i].name) { |
74 | //Getting contents of library to be copied | 91 | //Getting contents of library to be copied |
75 | this.chromeApi.directoryContents(contents[i], function (lib) { | 92 | this.chromeApi.directoryContents(contents[i], function (lib) { |
76 | //Creating directory structure from subfolders | 93 | //Creating directory structure from subfolders |
77 | this.copyDirectoryToCloud(path, contents[i], '/'+path, function (status) {console.log(status)}); | 94 | this.copyDirectoryToCloud(path, contents[i], path, function (status) {console.log(status)}); |
78 | }.bind(this)); | 95 | }.bind(this)); |
79 | break; | 96 | break; |
80 | } | 97 | } |
@@ -99,7 +116,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
99 | dir = folder.name; | 116 | dir = folder.name; |
100 | } | 117 | } |
101 | // | 118 | // |
102 | if (!this.coreApi.createDirectory({uri: '/'+dir+'/'})) { | 119 | if (!this.coreApi.createDirectory({uri: dir})) { |
103 | //Error occured while creating folders | 120 | //Error occured while creating folders |
104 | return; | 121 | return; |
105 | } | 122 | } |
@@ -140,6 +157,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { | |||
140 | //Parsing json libraries | 157 | //Parsing json libraries |
141 | libs = JSON.parse(xhr.response); | 158 | libs = JSON.parse(xhr.response); |
142 | // | 159 | // |
160 | this.libs = libs.libraries; | ||
161 | // | ||
143 | if (chromeLibs.length > 0) { | 162 | if (chromeLibs.length > 0) { |
144 | // | 163 | // |
145 | for (i=0; chromeLibs[i]; i++) { | 164 | for (i=0; chromeLibs[i]; i++) { |