From c583cba4b996d327e1a4a137f0a338872b7e3167 Mon Sep 17 00:00:00 2001 From: James Date: Thu, 27 Jul 2017 19:02:02 +1000 Subject: [PATCH] Implement lookup table for wiki entries --- scripts/games/app.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/games/app.js b/scripts/games/app.js index 42e8a8d..9446176 100644 --- a/scripts/games/app.js +++ b/scripts/games/app.js @@ -72,6 +72,7 @@ gitPull(fsPathWiki, 'https://github.com/citra-emu/citra-games-wiki.wiki.git'); // Fetch all issues from Github. var githubIssues = null; +var wikiEntries = {}; getGithubIssues() .then(function(issues) { @@ -88,6 +89,14 @@ getGithubIssues() }); }) .then(function() { + // Transform wiki entries to lowercase + const files = fs.readdirSync(fsPathWiki); + + logger.info(`Generating wiki database...`); + files.forEach((file) => { + wikiEntries[file.toLowerCase()] = file; + }); + // Loop through each game and process it. getDirectories(fsPathCode).forEach(function(game) { processGame(game); @@ -220,7 +229,7 @@ function processGame(game) { // WIKI BLOCK var wikiText = ""; - let fsPathWikiGame = `${fsPathWiki}/${game}.md`; + let fsPathWikiGame = `${fsPathWiki}/${wikiEntries[game.toLowerCase() + ".md"]}`; if (fs.existsSync(fsPathWikiGame)) { wikiText = fs.readFileSync(fsPathWikiGame, 'utf8');