You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/06/14 19:31:52 UTC

[83/83] [abbrv] git commit: use symlink instead of copying. Partial fix for [CB-3812]

use symlink instead of copying. Partial fix for [CB-3812]


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

Branch: refs/heads/lazy
Commit: d2392da27aeae5bead4c1d089d9f16d541f73026
Parents: f829e63
Author: Fil Maj <ma...@gmail.com>
Authored: Fri Jun 14 10:30:04 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Fri Jun 14 10:30:04 2013 -0700

----------------------------------------------------------------------
 src/lazy_load.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/d2392da2/src/lazy_load.js
----------------------------------------------------------------------
diff --git a/src/lazy_load.js b/src/lazy_load.js
index 4919ab8..c90b0aa 100644
--- a/src/lazy_load.js
+++ b/src/lazy_load.js
@@ -47,13 +47,14 @@ module.exports = {
         });
     },
     custom:function(url, id, platform, version, callback) {
-        var download_dir = path.join(util.libDirectory, platform, id, version);
+        var id_dir = path.join(util.libDirectory, platform, id);
+        shell.mkdir('-p', id_dir);
+        var download_dir = path.join(id_dir, version);
         if (fs.existsSync(download_dir)) {
             events.emit('log', 'Platform library for "' + platform + '" already exists. No need to download. Continuing.');
             if (callback) callback();
             return;
         }
-        shell.mkdir('-p', download_dir);
         hooker.fire('before_library_download', {
             platform:platform,
             url:url,
@@ -62,6 +63,7 @@ module.exports = {
         }, function() {
             var uri = URL.parse(url);
             if (uri.protocol) {
+                shell.mkdir(download_dir);
                 // assuming its remote
                 var filename = path.join(download_dir, id+'-'+platform+'-'+version+'.tar.gz');
                 if (fs.existsSync(filename)) {
@@ -136,7 +138,8 @@ module.exports = {
                 req.end();
             } else {
                 // local path
-                shell.cp('-rf', path.join(uri.path, '*'), download_dir);
+                // symlink instead of copying
+                fs.symlinkSync(uri.path, download_dir, 'dir');
                 hooker.fire('after_library_download', {
                     platform:platform,
                     url:url,