You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/07/30 22:45:47 UTC

git commit: On lazy load error, rmeove any created directories.

Updated Branches:
  refs/heads/master 1bc395be1 -> 1e2001815


On lazy load error, rmeove any created directories.


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

Branch: refs/heads/master
Commit: 1e2001815423ed52d178b8c5d3725dd60700639c
Parents: 1bc395b
Author: Fil Maj <ma...@gmail.com>
Authored: Tue Jul 30 13:45:43 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Tue Jul 30 13:45:43 2013 -0700

----------------------------------------------------------------------
 src/lazy_load.js | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/1e200181/src/lazy_load.js
----------------------------------------------------------------------
diff --git a/src/lazy_load.js b/src/lazy_load.js
index aeda169..a3a62a2 100644
--- a/src/lazy_load.js
+++ b/src/lazy_load.js
@@ -50,9 +50,7 @@ module.exports = {
         });
     },
     custom:function(url, id, platform, version, callback) {
-        var id_dir = path.join(util.libDirectory, platform, id);
-        shell.mkdir('-p', id_dir);
-        var download_dir = path.join(id_dir, version);
+        var download_dir = path.join(util.libDirectory, platform, id, version);
         if (fs.existsSync(download_dir)) {
             events.emit('log', id + ' library for "' + platform + '" already exists. No need to download. Continuing.');
             if (callback) return callback();
@@ -85,6 +83,7 @@ module.exports = {
                     .pipe(zlib.createUnzip())
                     .pipe(tar.Extract({path:download_dir}))
                     .on('error', function(err) {
+                        shell.rm('-rf', download_dir);
                         if (callback) callback(err);
                         else throw err;
                     })