You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2012/05/18 00:37:06 UTC

[2/19] js commit: trying to get entry object to work

trying to get entry object to work


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/a8bef382
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/a8bef382
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/a8bef382

Branch: refs/heads/playbookFile
Commit: a8bef3821d7a744b020b61c133797ae9f21e35fa
Parents: 9041cb7
Author: Tim Kim <ti...@nitobi.com>
Authored: Mon May 14 15:38:44 2012 -0700
Committer: Tim Kim <ti...@nitobi.com>
Committed: Mon May 14 15:38:44 2012 -0700

----------------------------------------------------------------------
 lib/playbook/plugin/playbook/Entry.js |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/a8bef382/lib/playbook/plugin/playbook/Entry.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/Entry.js b/lib/playbook/plugin/playbook/Entry.js
index c8071a9..1630493 100644
--- a/lib/playbook/plugin/playbook/Entry.js
+++ b/lib/playbook/plugin/playbook/Entry.js
@@ -2,7 +2,12 @@ var FileError = require('cordova/plugin/FileError'),
     LocalFileSystem = require('cordova/plugin/LocalFileSystem'),
     resolveLocalFileSystemURI = require('cordova/plugin/resolveLocalFileSystemURI');
 
-module.exports = {
+function playbookEntry(){
+
+}
+
+playbookEntry.prototype = {
+
     getMetadata : function(successCallback, errorCallback){
         var success = typeof successCallback !== 'function' ? null : function(lastModified) {
           var metadata = new Metadata(lastModified);
@@ -57,6 +62,25 @@ module.exports = {
                 }
             };
 
+        if(this.isFile){
+            if(blackberry.io.file.exists(parent + newName)){
+                // overwrite file
+
+            }else{
+                console.log('this.srcPath: ' + this.srcPath);
+                console.log('newName: ' + newName);
+                blackberry.io.file.copy(this.srcPath,parent+newName);
+                blackberry.io.deleteFile(this.srcPath);
+            }
+        }else{
+            if(blackberry.io.dir.exists(parent + newName)){
+                fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
+            }else{
+                blackberry.io.dir.createNewDir(parent + newName);
+                blackberry.io.dir.deleteDirectory(this.srcPath);
+            }
+        }
+
     },
 
     copyTo : function(parent, newName, successCallback, errorCallback) {
@@ -147,3 +171,5 @@ module.exports = {
         }
     }
 };
+
+module.exports = playbookEntry;
\ No newline at end of file