From 075252ad893452df446566f01d0b26eeab08be3d Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 15 Feb 2012 23:07:00 -0800 Subject: Setting up webGL library copy on save --- js/io/system/ninjalibrary.js | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'js/io/system/ninjalibrary.js') 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, { }, //////////////////////////////////////////////////////////////////// // + _libs: { + enumerable: false, + value: null + }, + //////////////////////////////////////////////////////////////////// + // + libs: { + enumerable: false, + get: function() { + return this._libs; + }, + set: function(value) { + this._libs = value; + } + }, + //////////////////////////////////////////////////////////////////// + // _libsToSync: { enumerable: false, value: 0 @@ -67,14 +84,14 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { enumerable: false, value: function (path, libName) { // - if(this.coreApi.directoryExists({uri: '/'+path+'/'+libName+'/'}).status === 404) { + if(this.coreApi.directoryExists({uri: path+libName}).status === 404) { this.chromeApi.directoryContents(this.chromeApi.fileSystem.root, function (contents) { for (var i in contents) { if (libName === contents[i].name) { //Getting contents of library to be copied this.chromeApi.directoryContents(contents[i], function (lib) { //Creating directory structure from subfolders - this.copyDirectoryToCloud(path, contents[i], '/'+path, function (status) {console.log(status)}); + this.copyDirectoryToCloud(path, contents[i], path, function (status) {console.log(status)}); }.bind(this)); break; } @@ -99,7 +116,7 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { dir = folder.name; } // - if (!this.coreApi.createDirectory({uri: '/'+dir+'/'})) { + if (!this.coreApi.createDirectory({uri: dir})) { //Error occured while creating folders return; } @@ -140,6 +157,8 @@ exports.NinjaLibrary = Montage.create(Object.prototype, { //Parsing json libraries libs = JSON.parse(xhr.response); // + this.libs = libs.libraries; + // if (chromeLibs.length > 0) { // for (i=0; chromeLibs[i]; i++) { -- cgit v1.2.3