From af58afcffff5ac556d16f050a325ac0406897fcd Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 7 Feb 2012 17:03:44 -0800 Subject: Copy local library to cloud Adding functionality to copy a local library to the cloud. Currently creating directory structure. Need to add ability to copy files and ensure proper mime-type is set. --- js/io/system/chromeapi.js | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'js/io/system/chromeapi.js') diff --git a/js/io/system/chromeapi.js b/js/io/system/chromeapi.js index 2fc8769c..fc93b22a 100644 --- a/js/io/system/chromeapi.js +++ b/js/io/system/chromeapi.js @@ -7,11 +7,10 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot /* ///////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// NOTES: + The init function starts up the file system API, and a size must be set, no unlimited available as of now. - Core API reference in NINJA: this.application.ninja.coreIoApi - //////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// */ // @@ -123,6 +122,46 @@ exports.ChromeApi = Montage.create(Object.prototype, { } }, //////////////////////////////////////////////////////////////////// + // + fileDelete: { + enumerable: true, + value: function(filePath, callback) { + this.fileSystem.root.getFile(filePath, {create: false}, function(file) { + file.remove(function() { + if (callback) callback(true); + }); + }, function (e) {if (callback) callback(false)}); + } + }, + //////////////////////////////////////////////////////////////////// + // + fileContent: { + enumerable: true, + value: function() { + } + }, + //////////////////////////////////////////////////////////////////// + // + fileCopy: { + enumerable: true, + value: function() { + } + }, + //////////////////////////////////////////////////////////////////// + // + fileRename: { + enumerable: true, + value: function() { + } + }, + //////////////////////////////////////////////////////////////////// + // + fileMove: { + enumerable: true, + value: function() { + } + }, + //////////////////////////////////////////////////////////////////// //Creating directory from path, callback optional directoryNew: { enumerable: true, -- cgit v1.2.3