Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

Commit 49fea56

Browse files
authored
Merge pull request #20 from AtticFinder65536/fix-gdpath-read
shuffle.js: remove newlines and carriage returns from gdPath before using it
2 parents 93273c3 + b81a785 commit 49fea56

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

shuffle.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ let iconRegex = /^.+?_(\d+?)_.+/
3636
let forms = assets.forms
3737
let sheetList = Object.keys(assets.sheets)
3838
let glowName = sheetList.filter(x => x.startsWith('GJ_GameSheetGlow'))
39-
let gdPath = process.argv[2] ?? fs.readFileSync('directory.txt', 'utf8')
39+
40+
// newlines/CRs are usually present in text files, strip them out so they aren't part of the pathname
41+
let gdPath = process.argv[2] ?? fs.readFileSync('directory.txt', 'utf8').replace(/[\n\r]/g, '')
42+
4043
if (!fs.existsSync(gdPath)) throw "Couldn't find your GD directory! Make sure to enter the correct file path in directory.txt"
4144
let glowPlist = fs.readFileSync(`${gdPath}/${glowName[0]}.plist`, 'utf8')
4245
let sheetNames = sheetList.filter(x => !glowName.includes(x))

0 commit comments

Comments
 (0)