From 40d53d89d16c6fd6e4e05d9ad8f9a46ac27c1352 Mon Sep 17 00:00:00 2001 From: Dominik Reh Date: Tue, 25 Oct 2022 00:45:35 +0200 Subject: [PATCH] Hotfix for old scripts/wildcards path loading --- javascript/tagAutocomplete.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/javascript/tagAutocomplete.js b/javascript/tagAutocomplete.js index 7d94c4b..14b7054 100644 --- a/javascript/tagAutocomplete.js +++ b/javascript/tagAutocomplete.js @@ -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