From a2cc7d1db93237d69f8b3d7a4f72472976f460c1 Mon Sep 17 00:00:00 2001 From: zsxeee Date: Tue, 12 Oct 2021 15:10:32 +0800 Subject: [PATCH] Avoid directory not found error --- extra/update-language-files/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extra/update-language-files/index.js b/extra/update-language-files/index.js index a90f9f36..7ba30cc0 100644 --- a/extra/update-language-files/index.js +++ b/extra/update-language-files/index.js @@ -26,10 +26,12 @@ const copyRecursiveSync = function (src, dest) { } }; -console.log("Arguments:", process.argv) +console.log("Arguments:", process.argv); const baseLangCode = process.argv[2] || "en"; console.log("Base Lang: " + baseLangCode); -fs.rmdirSync("./languages", { recursive: true }); +if (fs.existsSync("./languages")) { + fs.rmdirSync("./languages", { recursive: true }); +} copyRecursiveSync("../../src/languages", "./languages"); const en = (await import("./languages/en.js")).default; @@ -39,7 +41,7 @@ console.log("Files:", files); for (const file of files) { if (!file.endsWith(".js")) { - console.log("Skipping " + file) + console.log("Skipping " + file); continue; }