cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [83/83] [abbrv] git commit: use symlink instead of copying. Partial fix for [CB-3812]
Date Fri, 14 Jun 2013 17:31:52 GMT
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 <maj.fil@gmail.com>
Authored: Fri Jun 14 10:30:04 2013 -0700
Committer: Fil Maj <maj.fil@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,


Mime
View raw message