I'm building an application (for mac) that runs on java, and I need it to be able to edit its own contents. Because, after all, an application is just a glorified directory, I assumed that you could use it to change what is inside of it. But this application will be distributed, and I have no idea where the user will wish to place the application. Currently, all file references that I have been making have been using File("path/from/user/to/application")
but of course, that assumes that you can find your application from the user home drive. Is there a way to do it not knowing where the .app file is stored? My current directory setup within the app is this:
app.app
Contents
|Info.plist
|PkgInfo
|---Resources
| |icon.icns
|
|---MacOS
| |JavaAppLauncher
|
|---Java
|---app.jar
|---package
|classFile.class
|---Folder
|FileToEdit.xml
So is there a way to find and read/change FileToEdit.xml within the java code (stored in classFile.class) without knowing where app.app is?