Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
Erase tmp dir when --reset (fixes #224)
Browse files Browse the repository at this point in the history
  • Loading branch information
brrd committed Feb 13, 2018
1 parent 0e8c2c5 commit 8c00139
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions app/creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,19 @@ creator.create = function () {
]);
};

// Erase the whole configuration
// Erase the whole configuration + temporary files
creator.erase = function () {
return new Promise (function (resolve, reject) {
files.deleteDir(constants.path.userData, function (err) {
if (err) reject(err);
else resolve();
});
});
function getErasePromise (dirPath) {
return new Promise (function (resolve, reject) {
files.deleteDir(dirPath, function (err) {
if (err) reject(err);
else resolve();
});
});
}
var p1 = getErasePromise(constants.path.userData);
var p2 = getErasePromise(constants.path.tmp);
return Promise.all([p1, p2]);
};

// Reset: erase then create a new clear config
Expand Down

0 comments on commit 8c00139

Please # to comment.