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

[30/48] js commit: fixed file onto existing directory

fixed file onto existing directory


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

Branch: refs/heads/master
Commit: dabfc154752804e1fe3bfb0642daaa45ec4c2918
Parents: 709fb6f
Author: Tim Kim <ti...@nitobi.com>
Authored: Wed May 30 15:02:48 2012 -0700
Committer: Tim Kim <ti...@nitobi.com>
Committed: Thu Jun 7 13:40:23 2012 -0700

----------------------------------------------------------------------
 lib/playbook/plugin/playbook/Entry.js |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/dabfc154/lib/playbook/plugin/playbook/Entry.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/Entry.js b/lib/playbook/plugin/playbook/Entry.js
index dcbcdc0..00a83b9 100644
--- a/lib/playbook/plugin/playbook/Entry.js
+++ b/lib/playbook/plugin/playbook/Entry.js
@@ -88,6 +88,8 @@ module.exports = {
                     theEntry.isFile = true;
                     success(theEntry);
 
+                }else if(blackberry.io.dir.exists(parent.fullPath + '/' + name)){
+                    fail(FileError.INVALID_MODIFICATION_ERR);
                 }else{
                     blackberry.io.file.copy(srcPath,parent.fullPath + '/' + name);
                     blackberry.io.file.deleteFile(srcPath);
@@ -104,7 +106,7 @@ module.exports = {
             }
         }else{
             if(srcPath != parent.fullPath + '/' + name){
-                if(blackberry.io.dir.exists(parent.fullPath + '/' + name) || srcPath == parent.fullPath){
+                if(blackberry.io.dir.exists(parent.fullPath + '/' + name) || blackberry.io.file.exists(parent.fullPath + '/' + name) || srcPath == parent.fullPath){
                     fail(FileError.INVALID_MODIFICATION_ERR);
                 }else{
                     blackberry.io.dir.createNewDir(parent.fullPath + '/' + name);
@@ -192,7 +194,7 @@ module.exports = {
         }else{
             if(srcPath != parent.fullPath + '/' + name){
                 var destPath = parent.fullPath + '/' + name;
-                if(destPath.indexOf(srcPath)>=0){
+                if(destPath.indexOf(srcPath)>=0 || blackberry.io.file.exists(parent.fullPath + '/' + name)){
                     fail(FileError.INVALID_MODIFICATION_ERR);
                 }else{
                     recursiveCopy(srcPath, parent.fullPath + '/' + name);