cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an-s...@apache.org
Subject [3/6] cordova-lib git commit: CB-11194 Defer creating of libDir folder until something actually requests it
Date Tue, 09 Aug 2016 09:31:32 GMT
CB-11194 Defer creating of libDir folder until something actually requests it

This closes #462


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

Branch: refs/heads/6.3.x
Commit: 647852e5e48f779cc99c91b470d35b177644c342
Parents: e4f30ce
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Fri Jul 1 16:35:53 2016 -0700
Committer: Vladimir Kotikov <v-vlkoti@microsoft.com>
Committed: Mon Aug 8 10:46:01 2016 +0300

----------------------------------------------------------------------
 cordova-lib/src/cordova/util.js | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/647852e5/cordova-lib/src/cordova/util.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/util.js b/cordova-lib/src/cordova/util.js
index 1bc227e..e617e08 100644
--- a/cordova-lib/src/cordova/util.js
+++ b/cordova-lib/src/cordova/util.js
@@ -38,11 +38,22 @@ if (!global_config_path) {
 var origCwd = null;
 
 var lib_path = path.join(global_config_path, 'lib');
-shell.mkdir('-p', lib_path);
+
 
 exports.binname = 'cordova';
 exports.globalConfig = global_config_path;
-exports.libDirectory = lib_path;
+
+// defer defining libDirectory on exports so we don't create it if 
+// someone simply requires this module
+Object.defineProperty(exports,'libDirectory', {
+        configurable: true,
+        get: function () {
+            shell.mkdir('-p', lib_path);
+            exports.libDirectory = lib_path;
+        return lib_path;
+    }
+});
+
 addModuleProperty(module, 'plugin_parser', './plugin_parser');
 
 exports.isCordova = isCordova;


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


Mime
View raw message