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/06/07 22:40:44 UTC

[45/48] 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/93d7f505
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/93d7f505
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/93d7f505

Branch: refs/heads/master
Commit: 93d7f5057e65663c0899ea788415919e451a5183
Parents: 9d2ad4c
Author: Tim Kim <ti...@nitobi.com>
Authored: Mon May 14 15:38:44 2012 -0700
Committer: Tim Kim <ti...@nitobi.com>
Committed: Thu Jun 7 13:40:22 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/93d7f505/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