Attempt to fix MapComplete/MapComplete#2300
This commit is contained in:
parent
a38ff16ffe
commit
6d34849d91
1 changed files with 6 additions and 3 deletions
|
@ -327,8 +327,11 @@ class NsiLogos extends Script {
|
||||||
|
|
||||||
private async patchNsiFile(){
|
private async patchNsiFile(){
|
||||||
const files = NsiLogos.downloadedFiles()
|
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 nsi = JSON.parse(readFileSync(path, "utf8"))
|
||||||
const types = nsi.nsi
|
const types = nsi.nsi
|
||||||
|
|
||||||
|
@ -336,12 +339,12 @@ class NsiLogos extends Script {
|
||||||
const t: NSIItem[] = types[k].items
|
const t: NSIItem[] = types[k].items
|
||||||
for (const nsiItem of t) {
|
for (const nsiItem of t) {
|
||||||
const file = files.get(nsiItem.id)
|
const file = files.get(nsiItem.id)
|
||||||
|
delete nsiItem.fromTemplate
|
||||||
if(!file){
|
if(!file){
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const extension = file.match(/.*\.([a-z]{3})/)[1]
|
const extension = file.match(/.*\.([a-z]{3})/)[1]
|
||||||
nsiItem["ext"] = extension
|
nsiItem["ext"] = extension
|
||||||
delete nsiItem.fromTemplate
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
writeFileSync(path, JSON.stringify(nsi), "utf8")
|
writeFileSync(path, JSON.stringify(nsi), "utf8")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue