From 8c00139649f8d1586bd7bfad2815f244677abebf Mon Sep 17 00:00:00 2001 From: Thomas Brouard Date: Tue, 13 Feb 2018 19:18:13 +0100 Subject: [PATCH] Erase tmp dir when --reset (fixes #224) --- app/creator.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/creator.js b/app/creator.js index 63053e1..f2f1dce 100644 --- a/app/creator.js +++ b/app/creator.js @@ -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