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

[14/48] js commit: Added some clarifcation to comment

Added some clarifcation to comment


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

Branch: refs/heads/master
Commit: 86986eb1d33dc89c39e6628370ea7fbf6a65fa4d
Parents: 93352e7
Author: Tim Kim <ti...@nitobi.com>
Authored: Mon Jun 4 14:35:18 2012 -0700
Committer: Tim Kim <ti...@nitobi.com>
Committed: Thu Jun 7 13:40:24 2012 -0700

----------------------------------------------------------------------
 lib/playbook/plugin/playbook/Entry.js |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/86986eb1/lib/playbook/plugin/playbook/Entry.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/Entry.js b/lib/playbook/plugin/playbook/Entry.js
index b30af48..a9d90ae 100644
--- a/lib/playbook/plugin/playbook/Entry.js
+++ b/lib/playbook/plugin/playbook/Entry.js
@@ -110,14 +110,19 @@ module.exports = {
                     // destination path is a directory
                     fail(FileError.INVALID_MODIFICATION_ERR);
                 }else{
-                    blackberry.io.file.copy(srcPath,dstPath);
-                    blackberry.io.file.deleteFile(srcPath);
+                    // make sure the directory that we are moving to actually exists
+                    if(blackberry.io.dir.exists(parent.fullPath)){
+                        blackberry.io.file.copy(srcPath,dstPath);
+                        blackberry.io.file.deleteFile(srcPath);
 
-                    theEntry.fullPath = dstPath;
-                    theEntry.name = name;
-                    theEntry.isDirectory = false;
-                    theEntry.isFile = true;
-                    success(theEntry);
+                        theEntry.fullPath = dstPath;
+                        theEntry.name = name;
+                        theEntry.isDirectory = false;
+                        theEntry.isFile = true;
+                        success(theEntry);
+                    }else{
+                        fail(FileError.NOT_FOUND_ERR);
+                    }
                 }
             }else{
                 // file onto itself
@@ -126,7 +131,7 @@ module.exports = {
         }else{
             if(srcPath != dstPath){
                 if(blackberry.io.file.exists(dstPath) || srcPath == parent.fullPath){
-                    // destination path is either a file path or
+                    // destination path is either a file path or moving into parent
                     fail(FileError.INVALID_MODIFICATION_ERR);
                 }else{
                     if(!blackberry.io.dir.exists(dstPath)){