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/68af465c Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/68af465c Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/68af465c Branch: refs/heads/common-1.4.x Commit: 68af465ca7906c47bebfa9428124e83855dda6f6 Parents: a0d8e28 Author: Jesse MacFadyen <purplecabb...@gmail.com> Authored: Fri Jul 1 16:35:53 2016 -0700 Committer: Vladimir Kotikov <v-vlk...@microsoft.com> Committed: Wed Aug 3 12:53:29 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/68af465c/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-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org