From b9b1b0488aab341b709f71f8ff7ec0f972d3c2fd Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 24 Mar 2021 21:21:58 -0300 Subject: only load JSON files as language data --- upd8.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/upd8.js b/upd8.js index 8ee4105..ba21e64 100755 --- a/upd8.js +++ b/upd8.js @@ -612,9 +612,10 @@ const list = { // only the track listing, not track data itself), and dealing with errors of // missing track files (or track files which are not linked to al8ums). All a // 8unch of stuff that's a pain to deal with for no apparent 8enefit. -async function findFiles(dataPath) { +async function findFiles(dataPath, filter = f => true) { return (await readdir(dataPath)) - .map(file => path.join(dataPath, file)); + .map(file => path.join(dataPath, file)) + .filter(file => filter(file)); } function* getSections(lines) { @@ -5316,7 +5317,7 @@ async function main() { } if (langPath) { - const languageDataFiles = await findFiles(langPath); + const languageDataFiles = await findFiles(langPath, f => path.extname(f) === '.json'); const results = await progressPromiseAll(`Reading & processing language files.`, languageDataFiles .map(file => processLanguageFile(file, defaultStrings.json))); -- cgit 1.3.0-6-gf8a5