Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 450B39A3B for ; Thu, 17 May 2012 22:37:08 +0000 (UTC) Received: (qmail 55290 invoked by uid 500); 17 May 2012 22:37:08 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 55272 invoked by uid 500); 17 May 2012 22:37:08 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 55262 invoked by uid 99); 17 May 2012 22:37:08 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 May 2012 22:37:08 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D462D167FC; Thu, 17 May 2012 22:37:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: timkim@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [6/19] js commit: setting up entry object Message-Id: <20120517223707.D462D167FC@tyr.zones.apache.org> Date: Thu, 17 May 2012 22:37:07 +0000 (UTC) setting up entry object Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/8ee7d1ef Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/8ee7d1ef Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/8ee7d1ef Branch: refs/heads/playbookFile Commit: 8ee7d1ef7855a4ee2a374342cd146991e100f2ce Parents: bb6d27d Author: Tim Kim Authored: Fri May 11 14:24:17 2012 -0700 Committer: Tim Kim Committed: Fri May 11 14:24:17 2012 -0700 ---------------------------------------------------------------------- lib/playbook/plugin/playbook/DirectoryEntry.js | 1 + lib/playbook/plugin/playbook/Entry.js | 120 ++++++++------- lib/playbook/plugin/playbook/requestFileSystem.js | 4 - .../plugin/playbook/resolveLocalFileSystemURI.js | 3 +- 4 files changed, 64 insertions(+), 64 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/8ee7d1ef/lib/playbook/plugin/playbook/DirectoryEntry.js ---------------------------------------------------------------------- diff --git a/lib/playbook/plugin/playbook/DirectoryEntry.js b/lib/playbook/plugin/playbook/DirectoryEntry.js index e261e53..101d526 100644 --- a/lib/playbook/plugin/playbook/DirectoryEntry.js +++ b/lib/playbook/plugin/playbook/DirectoryEntry.js @@ -84,6 +84,7 @@ module.exports = { if (dirPath.substr(-1) !== '/') { dirPath += '/'; } + console.log('creating dir path at: ' + dirPath); blackberry.io.dir.createNewDir(dirPath); createEntry(); } catch (eone) { http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/8ee7d1ef/lib/playbook/plugin/playbook/Entry.js ---------------------------------------------------------------------- diff --git a/lib/playbook/plugin/playbook/Entry.js b/lib/playbook/plugin/playbook/Entry.js index 21a0408..c8071a9 100644 --- a/lib/playbook/plugin/playbook/Entry.js +++ b/lib/playbook/plugin/playbook/Entry.js @@ -3,66 +3,66 @@ var FileError = require('cordova/plugin/FileError'), resolveLocalFileSystemURI = require('cordova/plugin/resolveLocalFileSystemURI'); module.exports = { - getMetadata : function(successCallback, errorCallback){ - var success = typeof successCallback !== 'function' ? null : function(lastModified) { - var metadata = new Metadata(lastModified); - successCallback(metadata); - }; - var fail = typeof errorCallback !== 'function' ? null : function(code) { - errorCallback(new FileError(code)); - }; - - if(this.isFile){ - if(blackberry.io.file.exists(this.fullPath)){ - var theFileProperties = blackberry.io.file.getFileProperties(this.fullPath); - success(theFileProperties.dateModified) - } + getMetadata : function(successCallback, errorCallback){ + var success = typeof successCallback !== 'function' ? null : function(lastModified) { + var metadata = new Metadata(lastModified); + successCallback(metadata); + }; + var fail = typeof errorCallback !== 'function' ? null : function(code) { + errorCallback(new FileError(code)); + }; + + if(this.isFile){ + if(blackberry.io.file.exists(this.fullPath)){ + var theFileProperties = blackberry.io.file.getFileProperties(this.fullPath); + success(theFileProperties.dateModified); + } }else{ - console.log('Unsupported for directories') - fail(FileError.INVALID_MODIFICATION_ERR); + console.log('Unsupported for directories') + fail(FileError.INVALID_MODIFICATION_ERR); + } + }, + + moveTo : function(parent, newName, successCallback, errorCallback){ + var fail = function(code) { + if (typeof errorCallback === 'function') { + errorCallback(new FileError(code)); + } + }; + // user must specify parent Entry + if (!parent) { + fail(FileError.NOT_FOUND_ERR); + return; } - }, - - moveTo : function(parent, newName, successCallback, errorCallback){ - var fail = function(code) { - if (typeof errorCallback === 'function') { - errorCallback(new FileError(code)); - } - }; - // user must specify parent Entry - if (!parent) { - fail(FileError.NOT_FOUND_ERR); - return; - } - // source path - var srcPath = this.fullPath, - // entry name - name = newName || this.name, - success = function(entry) { - if (entry) { - if (typeof successCallback === 'function') { - // create appropriate Entry object - var result = (entry.isDirectory) ? new (require('cordova/plugin/playbook/DirectoryEntry'))(entry.name, entry.fullPath) : new (require('cordova/plugin/playbook/FileEntry'))(entry.name, entry.fullPath); - try { - successCallback(result); - } - catch (e) { - console.log('Error invoking callback: ' + e); - } - } - } - else { - // no Entry object returned - fail(FileError.NOT_FOUND_ERR); - } - }; - - }, - - copyTo : function(parent, newName, successCallback, errorCallback) { - - }, - + // source path + var srcPath = this.fullPath, + // entry name + name = newName || this.name, + success = function(entry) { + if (entry) { + if (typeof successCallback === 'function') { + // create appropriate Entry object + var result = (entry.isDirectory) ? new (require('cordova/plugin/playbook/DirectoryEntry'))(entry.name, entry.fullPath) : new (require('cordova/plugin/playbook/FileEntry'))(entry.name, entry.fullPath); + try { + successCallback(result); + } + catch (e) { + console.log('Error invoking callback: ' + e); + } + } + } + else { + // no Entry object returned + fail(FileError.NOT_FOUND_ERR); + } + }; + + }, + + copyTo : function(parent, newName, successCallback, errorCallback) { + + }, + remove : function(successCallback, errorCallback) { var path = this.fullPath, // directory contents @@ -90,7 +90,9 @@ module.exports = { else if (blackberry.io.dir.exists(path)) { // it is an error to attempt to remove the file system root console.log('entry directory'); - if (exec(null, null, "File", "isFileSystemRoot", [ path ]) === true) { + // TODO: gotta figure out how to get root dirs on playbook - + // getRootDirs doesn't work + if (false) { fail(FileError.NO_MODIFICATION_ALLOWED_ERR); } else { // check to see if directory is empty http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/8ee7d1ef/lib/playbook/plugin/playbook/requestFileSystem.js ---------------------------------------------------------------------- diff --git a/lib/playbook/plugin/playbook/requestFileSystem.js b/lib/playbook/plugin/playbook/requestFileSystem.js index 20aab56..68c2832 100644 --- a/lib/playbook/plugin/playbook/requestFileSystem.js +++ b/lib/playbook/plugin/playbook/requestFileSystem.js @@ -23,10 +23,6 @@ var requestFileSystem = function(type, size, successCallback, errorCallback) { var success = function(file_system) { if (file_system) { if (typeof successCallback === 'function') { - // grab the name and root from the file system object - //var result = new FileSystem(file_system.name, file_system.root); - console.log('file_system.name ' + file_system.name); - console.log('file_system.root ' + file_system.root); successCallback(file_system); } } http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/8ee7d1ef/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js ---------------------------------------------------------------------- diff --git a/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js b/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js index 5e30537..75b3f7d 100644 --- a/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js +++ b/lib/playbook/plugin/playbook/resolveLocalFileSystemURI.js @@ -37,11 +37,12 @@ module.exports = function(uri, successCallback, errorCallback) { } }; var theEntry = {}; - + console.log('the uri: ' + uri); if(blackberry.io.dir.exists(uri)){ theEntry.isDirectory = true; theEntry.name = uri.split('/').pop(); theEntry.fullPath = uri; + success(theEntry); }else if(blackberry.io.file.exists(uri)){ theEntry.isDirectory = false;