cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/4] git commit: Allow lazy_load libs to work without an id and version for local paths.
Date Thu, 16 Jan 2014 18:30:07 GMT
Allow lazy_load libs to work without an id and version for local paths.


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

Branch: refs/heads/master
Commit: b1d25559d9ba510af6fd1e517e4906ed4fb9545d
Parents: 47bf3c1
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Jan 16 10:58:28 2014 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Jan 16 10:58:28 2014 -0500

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


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b1d25559/src/lazy_load.js
----------------------------------------------------------------------
diff --git a/src/lazy_load.js b/src/lazy_load.js
index 3ca43f1..736ff55 100644
--- a/src/lazy_load.js
+++ b/src/lazy_load.js
@@ -43,18 +43,20 @@ module.exports = {
     },
     // Returns a promise for the path to the lazy-loaded directory.
     custom:function(url, id, platform, version) {
-        var download_dir = (platform == 'wp7' || platform == 'wp8' ? path.join(util.libDirectory,
'wp', id, version) :
-                                                                     path.join(util.libDirectory,
platform, id, version));
-
-        var lib_dir = platforms[platform] && platforms[platform].subdirectory &&
platform !== "blackberry10" ? path.join(download_dir, platforms[platform].subdirectory) :
download_dir;
+        var download_dir;
+        var lib_dir;
 
         // Return early for already-cached remote URL, or for local URLs.
         var uri = URL.parse(url);
-        if (uri.protocol && uri.protocol[1] != ':') { // second part of conditional
is for awesome windows support. fuuu windows
-          if (fs.existsSync(download_dir)) {
-            events.emit('verbose', id + ' library for "' + platform + '" already exists.
No need to download. Continuing.');
-            return Q(lib_dir);
-          }
+        var isUri = uri.protocol && uri.protocol[1] != ':'; // second part of conditional
is for awesome windows support. fuuu windows
+        if (isUri) {
+            download_dir = (platform == 'wp7' || platform == 'wp8' ? path.join(util.libDirectory,
'wp', id, version) :
+                                                                     path.join(util.libDirectory,
platform, id, version));
+            lib_dir = platforms[platform] && platforms[platform].subdirectory &&
platform !== "blackberry10" ? path.join(download_dir, platforms[platform].subdirectory) :
download_dir;
+            if (fs.existsSync(download_dir)) {
+                events.emit('verbose', id + ' library for "' + platform + '" already exists.
No need to download. Continuing.');
+                return Q(lib_dir);
+            }
         } else {
             // Local path.
             download_dir = uri.path;


Mime
View raw message