Hotfix for old scripts/wildcards path loading

This commit is contained in:
Dominik Reh
2022-10-25 00:45:35 +02:00
parent c733b836e8
commit 40d53d89d1

View File

@@ -413,7 +413,15 @@ function autocomplete(textArea, prompt, fixedTag = null) {
let wcFile = wcMatch[0][1];
let wcWord = wcMatch[0][2];
let wildcards = readFile(`file/extensions/wildcards/wildcards/${wcFile}.txt`).split("\n")
let wcBasePath = "";
if (wildcardExtFiles.includes(wcFile))
wcBasePath = "extensions/wildcards/wildcards";
else if (wildcardFiles.includes(wcFile))
wcBasePath = "scripts/wildcards";
else
throw "No valid wildcard file found";
let wildcards = readFile(`file/${wcBasePath}/${wcFile}.txt`).split("\n")
.filter(x => x.trim().length > 0); // Remove empty lines
results = wildcards.filter(x => (wcWord !== null && wcWord.length > 0) ? x.toLowerCase().includes(wcWord) : x) // Filter by tagword