From 6d34849d91339dda744bee7d28cfb4c527a242fc Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 28 Jan 2025 15:16:27 +0100 Subject: [PATCH] Attempt to fix https://source.mapcomplete.org/MapComplete/MapComplete/issues/2300 --- scripts/nsiLogos.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/nsiLogos.ts b/scripts/nsiLogos.ts index 0eb1af62f5..22ce0fb3f2 100644 --- a/scripts/nsiLogos.ts +++ b/scripts/nsiLogos.ts @@ -327,8 +327,11 @@ class NsiLogos extends Script { private async patchNsiFile(){ const files = NsiLogos.downloadedFiles() - const path = "./public/assets/data/nsi/nsi.min.json" - + let path = "./public/assets/data/nsi/nsi.min.json" + const otherPath = "./assets/data/nsi/nsi.min.json" + if (existsSync(otherPath) && !existsSync(path)) { + path = otherPath + } const nsi = JSON.parse(readFileSync(path, "utf8")) const types = nsi.nsi @@ -336,12 +339,12 @@ class NsiLogos extends Script { const t: NSIItem[] = types[k].items for (const nsiItem of t) { const file = files.get(nsiItem.id) + delete nsiItem.fromTemplate if(!file){ continue } const extension = file.match(/.*\.([a-z]{3})/)[1] nsiItem["ext"] = extension - delete nsiItem.fromTemplate } } writeFileSync(path, JSON.stringify(nsi), "utf8")