Skip to content

Commit 6004ca2

Browse files
committed
🛠️ Fix json export path not respecting relative paths
1 parent 6f2b0cb commit 6004ca2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/systems/jsonCompiler.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import type { IBlueprintBoneConfigJSON, IBlueprintVariantJSON } from '../blueprintFormat'
66
import { type defaultValues } from '../blueprintSettings'
77
import { EasingKey } from '../util/easing'
8+
import { resolvePath } from '../util/fileUtil'
89
import { detectCircularReferences, scrubUndefined } from '../util/misc'
910
import { Variant } from '../variants'
1011
import type { INodeTransform, IRenderedAnimation, IRenderedFrame } from './animationRenderer'
@@ -212,7 +213,16 @@ export function exportJSON(options: {
212213
}
213214
console.log('Scrubbed:', scrubUndefined(json))
214215

215-
fs.writeFileSync(aj.json_file, compileJSON(json).toString())
216+
let exportPath: string
217+
try {
218+
exportPath = resolvePath(aj.json_file)
219+
} catch (e) {
220+
console.log(`Failed to resolve export path '${aj.json_file}'`)
221+
console.error(e)
222+
return
223+
}
224+
225+
fs.writeFileSync(exportPath, compileJSON(json).toString())
216226
}
217227

218228
function serailizeRenderedNode(node: AnyRenderedNode): ExportedRenderedNode {

0 commit comments

Comments
 (0)