Did anybody find a way to load an image from the plug-in .jar?
Background:
A) The ImageInformation constructors accept either a File or a String.
B) Class.gerResourceAsStream(String path) returns an InputStream and I found no (reasonably fool-proof) way to obtain a File from an InputStream
C) Class.getResource(String path) return an URL, which can be converted to a URI and from this a File. So this seemed the way to go.
However the following code fails:
It crashes in line 3 with the error: java.lang.IllegalArgumentException: URI is not hierarchical in new File(uri);
Just for information:
*) url.path = file:/home/mmg/.local/share/Steam/steamapps/common/RisingWorldDedicatedServer/plugins/pnb/pnb.jar!/assets/0.png
*) uri.string = jar:file:/home/mmg/.local/share/Steam/steamapps/common/RisingWorldDedicatedServer/plugins/pnb/pnb.jar!/assets/0.png
*) url.protocol = "jar"
*) uri.scheme = "jar"
*) and, yes, the .jar file contains the "/assets/0.png" file.
(I would expect the path to start with "file:///", i.e. 3 slashes, bu maybe it does not matter)
Anyone has any suggestion? Thanks!