Skip to content

Commit

Permalink
🛠️ Fix json export path not respecting relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
SnaveSutit committed Jul 20, 2024
1 parent 6f2b0cb commit 6004ca2
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/systems/jsonCompiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import type { IBlueprintBoneConfigJSON, IBlueprintVariantJSON } from '../blueprintFormat'
import { type defaultValues } from '../blueprintSettings'
import { EasingKey } from '../util/easing'
import { resolvePath } from '../util/fileUtil'
import { detectCircularReferences, scrubUndefined } from '../util/misc'
import { Variant } from '../variants'
import type { INodeTransform, IRenderedAnimation, IRenderedFrame } from './animationRenderer'
Expand Down Expand Up @@ -212,7 +213,16 @@ export function exportJSON(options: {
}
console.log('Scrubbed:', scrubUndefined(json))

fs.writeFileSync(aj.json_file, compileJSON(json).toString())
let exportPath: string
try {
exportPath = resolvePath(aj.json_file)
} catch (e) {
console.log(`Failed to resolve export path '${aj.json_file}'`)
console.error(e)
return
}

fs.writeFileSync(exportPath, compileJSON(json).toString())
}

function serailizeRenderedNode(node: AnyRenderedNode): ExportedRenderedNode {
Expand Down

0 comments on commit 6004ca2

Please sign in to comment.