From ab801987b64cc494b74ce7fcdb619f289a386388 Mon Sep 17 00:00:00 2001 From: AtticFinder65536 Date: Wed, 15 Jun 2022 23:29:57 +1000 Subject: [PATCH] shuffle.js: support reading dir from argv[2] --- readme.txt | 7 ++++++- shuffle.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/readme.txt b/readme.txt index b7f7372..058fd9c 100644 --- a/readme.txt +++ b/readme.txt @@ -19,4 +19,9 @@ HOW TO USE: === If the program closes as soon as you open it, that means it crashed. -A file called crash_log.txt will be created - send it to Colon and he'll hopefully get around to fixing it. \ No newline at end of file +A file called crash_log.txt will be created - send it to Colon and he'll hopefully get around to fixing it. + +=== + +Mac/Linux/non-Windows users, or if the game is installed in a nonstandard location: +Replace the directory in directory.txt with whereever the game's Resources folder is located on your system, or simply pass it as a command-line argument. diff --git a/shuffle.js b/shuffle.js index 689146e..e08c8cd 100644 --- a/shuffle.js +++ b/shuffle.js @@ -36,7 +36,7 @@ let iconRegex = /^.+?_(\d+?)_.+/ let forms = assets.forms let sheetList = Object.keys(assets.sheets) let glowName = sheetList.filter(x => x.startsWith('GJ_GameSheetGlow')) -let gdPath = fs.readFileSync('directory.txt', 'utf8') +let gdPath = process.argv[2] ?? fs.readFileSync('directory.txt', 'utf8') if (!fs.existsSync(gdPath)) throw "Couldn't find your GD directory! Make sure to enter the correct file path in directory.txt" let glowPlist = fs.readFileSync(`${gdPath}/${glowName[0]}.plist`, 'utf8') let sheetNames = sheetList.filter(x => !glowName.includes(x)) @@ -135,4 +135,4 @@ console.log("Randomization complete!") } -catch(e) { console.log(e); fs.writeFileSync('crash_log.txt', e.stack ? `Something went wrong! Send this error to Colon and he'll get around to fixing it at some point.\n\n${e.stack}` : e, 'utf8') } \ No newline at end of file +catch(e) { console.log(e); fs.writeFileSync('crash_log.txt', e.stack ? `Something went wrong! Send this error to Colon and he'll get around to fixing it at some point.\n\n${e.stack}` : e, 'utf8') }