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

Commit e02c5b1

Browse files
committed
Fixed invalid directory + texture pack issues
1 parent a70870a commit e02c5b1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

shuffle.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ function plistToJson(file) {
1818
for (let key in data.frames) {
1919
let fileData = data.frames[key];
2020
for (let innerKey in fileData) {
21-
if (typeof fileData[innerKey] === 'string') fileData[innerKey] = JSON.parse(fileData[innerKey].replace(/{/g, '[').replace(/}/g, ']'));
21+
if (typeof fileData[innerKey] == 'string') {
22+
if (!fileData[innerKey].length) delete fileData[innerKey]
23+
else fileData[innerKey] = JSON.parse(fileData[innerKey].replace(/{/g, '[').replace(/}/g, ']'));
24+
}
2225
}}
2326
return data.frames
2427
}
@@ -34,6 +37,7 @@ let forms = assets.forms
3437
let sheetList = Object.keys(assets.sheets)
3538
let glowName = sheetList.filter(x => x.startsWith('GJ_GameSheetGlow'))
3639
let gdPath = fs.readFileSync('directory.txt', 'utf8')
40+
if (!fs.existsSync(gdPath)) throw "Couldn't find your GD directory! Make sure to enter the correct file path in directory.txt"
3741
let glowPlist = fs.readFileSync(`${gdPath}/${glowName[0]}.plist`, 'utf8')
3842
let sheetNames = sheetList.filter(x => !glowName.includes(x))
3943
let resources = fs.readdirSync(gdPath)
@@ -130,4 +134,4 @@ console.log("Randomization complete!")
130134

131135
}
132136

133-
catch(e) { console.log(e); fs.writeFileSync('crash_log.txt', `Something went wrong! Send this error to Colon and he'll get around to fixing it at some point.\n\n${e.stack}`, 'utf8') }
137+
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') }

0 commit comments

Comments
 (0)