« get me outta code hell

only load JSON files as language data - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-03-24 21:21:58 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-03-24 21:22:18 -0300
commitb9b1b0488aab341b709f71f8ff7ec0f972d3c2fd (patch)
tree9a7bd6f5e76e283a211d17d602a8fc26b79f7bcd
parent18b970bd7384858e3c2f12c0a71f2c2b012aede2 (diff)
only load JSON files as language data
-rwxr-xr-xupd8.js7
1 files 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)));