On the Mac OS, from what I understand you're suppose to store information in "/Library/Application Support/Your App Name" if the files are to be read by everyone. However when it comes to writing, this is an admin only folder.
Therefore, if you want to write data, you need to store it to "~/Library/Application Support/Your App Name". Notice the "~" at the front. When you do this, each user will have their own data for the app, and be able to read and write.
In Java, if I do new File("~/Library"), this does not work as expected. It just adds "~/Library" to my current folder. Instead what I'd like it to do is return "Users/myAccount/Library". I understand that it's suggested you store files there.
The question is how do I create a File object in Java to point to this folder?
Java, in its typical "why use one character when you can use forty" style, lets you access the "~"
directory via System.getProperty("user.home")
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With