cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/3] cordova-lib git commit: CB-8217 Fix plugin add --link when plugin given as relative path
Date Wed, 24 Dec 2014 21:22:54 GMT
CB-8217 Fix plugin add --link when plugin given as relative path


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

Branch: refs/heads/master
Commit: 7e093635280e47ce7202fa9876beb57e8a1183b3
Parents: 402d04b
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Wed Dec 24 16:20:00 2014 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Wed Dec 24 16:22:33 2014 -0500

----------------------------------------------------------------------
 cordova-lib/src/plugman/fetch.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/7e093635/cordova-lib/src/plugman/fetch.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/fetch.js b/cordova-lib/src/plugman/fetch.js
index 2170611..edc0d43 100644
--- a/cordova-lib/src/plugman/fetch.js
+++ b/cordova-lib/src/plugman/fetch.js
@@ -251,8 +251,10 @@ function copyPlugin(plugin_dir, plugins_dir, link) {
     var dest = path.join(plugins_dir, pinfo.id);
     shell.rm('-rf', dest);
     if (link) {
-        events.emit('verbose', 'Linking plugin "' + plugin_dir + '" => "' + dest + '"');
-        fs.symlinkSync(plugin_dir, dest, 'dir');
+        var isRelativePath = plugin_dir[1] != ':' && plugin_dir[0] != path.sep;
+        var fixedPath = isRelativePath ? path.join(path.relative(plugins_dir, process.env.PWD
|| process.cwd()), plugin_dir) : plugin_dir;
+        events.emit('verbose', 'Linking "' + dest + '" => "' + fixedPath + '"');
+        fs.symlinkSync(fixedPath, dest, 'dir');
     } else {
         shell.mkdir('-p', dest);
         events.emit('verbose', 'Copying plugin "' + plugin_dir + '" => "' + dest + '"');


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


Mime
View raw message