I'm trying to compile a Java application into a Mac OS X app bundle. I add the following setting to set the current working directory:
<bundleapp...>
...
<option value="-Duser.dir=$APP_ROOT/Contents/Resources"/>
</bundleapp>
In Contents/Resources/ there is a config directory.
When executing it, I get this strange behaviour :
new File("config/").exists()
returns false
new File("config/").getAbsolutePath()
returns /path/to/bundled/app/MyApp.app/Contents/Resources/config
new File("config/").getAbsoluteFile().exists()
returns true
I don't know why this happens and I would like to prevent adding getAbsoluteFile() everywhere in my code.
Any thoughts on this?
(Note: I'm using Oracle JDK 8)