From 6f0af5bfb05859fb625352f7fd40acb79f910730 Mon Sep 17 00:00:00 2001 From: Nan Date: Mon, 19 May 2025 17:02:40 +0800 Subject: [PATCH] Create only if the directory does not exist --- util/utils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/util/utils.js b/util/utils.js index 5680769..b0130f6 100644 --- a/util/utils.js +++ b/util/utils.js @@ -49,7 +49,11 @@ Utils.prototype.makeDir = function (/*String*/ folder) { try { stat = self.fs.statSync(resolvedPath); } catch (e) { - self.fs.mkdirSync(resolvedPath); + if (e.message && e.message.startsWith('ENOENT')) { + self.fs.mkdirSync(resolvedPath); + } else { + throw e; + } } if (stat && stat.isFile()) throw Errors.FILE_IN_THE_WAY(`"${resolvedPath}"`); });