cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject ios commit: CB-9552 Updating linked platform removes original files
Date Tue, 13 Oct 2015 00:45:49 GMT
Repository: cordova-ios
Updated Branches:
  refs/heads/master 02f6f9ecf -> 4039aeb6f


CB-9552 Updating linked platform removes original files

This closes #165

Signed-off-by: Shazron Abdullah <shazron@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/4039aeb6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/4039aeb6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/4039aeb6

Branch: refs/heads/master
Commit: 4039aeb6f87c6803df5814b8cdefb8c2058504a0
Parents: 02f6f9e
Author: Simon MacDonald <simon.macdonald@gmail.com>
Authored: Tue Sep 22 15:30:43 2015 -0400
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Mon Oct 12 17:42:02 2015 -0700

----------------------------------------------------------------------
 bin/lib/create.js | 47 ++++++++++++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/4039aeb6/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 02c0a76..ab6dacf 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -50,25 +50,34 @@ function setShellFatal(value, func) {
 function copyJsAndCordovaLib(projectPath, projectName, use_shared) {
     shell.cp('-f', path.join(ROOT, 'CordovaLib', 'cordova.js'), path.join(projectPath, 'www'));
     shell.cp('-rf', path.join(ROOT, 'cordova-js-src'), path.join(projectPath, 'platform_www'));
-    shell.rm('-rf', path.join(projectPath, 'CordovaLib'));
-
-    if (use_shared) {
-        update_cordova_subproject([path.join(projectPath, projectName +'.xcodeproj', 'project.pbxproj')]);
-        // Symlink not used in project file, but is currently required for plugman because
-        // it reads the VERSION file from it (instead of using the cordova/version script
-        // like it should).
-        fs.symlinkSync(path.join(ROOT, 'CordovaLib'), path.join(projectPath, 'CordovaLib'));
-    } else {
-        var r = path.join(projectPath, projectName);
-        shell.mkdir('-p', path.join(projectPath, 'CordovaLib', 'CordovaLib.xcodeproj'));
-        shell.cp('-f', path.join(r, '.gitignore'), projectPath);
-        shell.cp('-rf',path.join(ROOT, 'CordovaLib', 'Classes'), path.join(projectPath, 'CordovaLib'));
-        shell.cp('-f', path.join(ROOT, 'CordovaLib', 'VERSION'), path.join(projectPath, 'CordovaLib'));
-        shell.cp('-f', path.join(ROOT, 'CordovaLib', 'cordova.js'), path.join(projectPath,
'CordovaLib'));
-        shell.cp('-f', path.join(ROOT, 'CordovaLib', 'CordovaLib_Prefix.pch'), path.join(projectPath,
'CordovaLib'));
-        shell.cp('-f', path.join(ROOT, 'CordovaLib', 'CordovaLib.xcodeproj', 'project.pbxproj'),
path.join(projectPath, 'CordovaLib', 'CordovaLib.xcodeproj'));
-        update_cordova_subproject([path.join(r+'.xcodeproj', 'project.pbxproj'), path.join(projectPath,
'CordovaLib', 'CordovaLib.xcodeproj', 'project.pbxproj')]);
-    }
+    
+    fs.lstat(path.join(projectPath, 'CordovaLib'), function(err, stats) {
+        if (!err) {
+            if (stats.isSymbolicLink()) {
+                fs.unlinkSync(path.join(projectPath, 'CordovaLib'));
+            } else {
+                shell.rm('-rf', path.join(projectPath, 'CordovaLib'));
+            }
+        }
+        
+        if (use_shared) {
+            update_cordova_subproject([path.join(projectPath, projectName +'.xcodeproj',
'project.pbxproj')]);
+            // Symlink not used in project file, but is currently required for plugman because
+            // it reads the VERSION file from it (instead of using the cordova/version script
+            // like it should).
+            fs.symlinkSync(path.join(ROOT, 'CordovaLib'), path.join(projectPath, 'CordovaLib'));
+        } else {
+            var r = path.join(projectPath, projectName);
+            shell.mkdir('-p', path.join(projectPath, 'CordovaLib', 'CordovaLib.xcodeproj'));
+            shell.cp('-f', path.join(r, '.gitignore'), projectPath);
+            shell.cp('-rf',path.join(ROOT, 'CordovaLib', 'Classes'), path.join(projectPath,
'CordovaLib'));
+            shell.cp('-f', path.join(ROOT, 'CordovaLib', 'VERSION'), path.join(projectPath,
'CordovaLib'));
+            shell.cp('-f', path.join(ROOT, 'CordovaLib', 'cordova.js'), path.join(projectPath,
'CordovaLib'));
+            shell.cp('-f', path.join(ROOT, 'CordovaLib', 'CordovaLib_Prefix.pch'), path.join(projectPath,
'CordovaLib'));
+            shell.cp('-f', path.join(ROOT, 'CordovaLib', 'CordovaLib.xcodeproj', 'project.pbxproj'),
path.join(projectPath, 'CordovaLib', 'CordovaLib.xcodeproj'));
+            update_cordova_subproject([path.join(r+'.xcodeproj', 'project.pbxproj'), path.join(projectPath,
'CordovaLib', 'CordovaLib.xcodeproj', 'project.pbxproj')]);
+        }
+    });
 }
 
 function copyScripts(projectPath) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message