swordmaster2k/rpgwizard

BOARD_LINK Cannot read template: java.lang.IllegalArgumentException: URI is not hierarchical

swordmaster2k opened this issue · 0 comments

Reported by jnwill, program generator cannot read template when running from JAR file

jnwillYesterday at 7:42 PM
14:10:58.593  825060 [AWT-EventQueue-0] INFO  o.r.e.e.b.g.ProgramGenerator.generate:49 - Generating program, id=[1566151858593_a0a87105-97c4-44b2-82cd-bc5ea20b1721], parameters=[{boardName=level1-3.board, tileX=10.0, layer=0, tileY=20.0}], type=[board_link]
14:10:58.594  825061 [AWT-EventQueue-0] ERROR org.rpgwizard.editor.Driver.lambda$redirectUncaughtExceptions$0:60 - Uncaught Exception detected in thread Thread[AWT-EventQueue-0,6,main]
java.lang.IllegalArgumentException: URI is not hierarchical
    at java.io.File.<init>(File.java:418)
    at org.rpgwizard.editor.editors.board.generation.ProgramGenerator.readTemplate(ProgramGenerator.java:58)
    at org.rpgwizard.editor.editors.board.generation.ProgramGenerator.generate(ProgramGenerator.java:51)
    at org.rpgwizard.editor.editors.board.generation.ProgramGenerator.generate(ProgramGenerator.java:44)
    at org.rpgwizard.editor.editors.board.generation.ProgramDialog.collect(ProgramDialog.java:151)

I am running the jar directly
I checked the source code, you can use getResourceAsStream() or File f = new File(getClass().getResource("/MyResource").toExternalForm()); to fix it
reproduced when trying to link boards using Board_LINK