Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement reliable getLibraryFolder() and getDocumentsFolder() methods in MacPlatform #9
Comments
|
There is an open issue at https://bugs.openjdk.java.net/browse/JDK-8187981 but it doesn't seem to be getting much traction. There is an alternative to System.getProperty but it's through swing:
See https://gist.github.com/sampottinger/49aef03638b150257cca919954319f01. It does work on 10.14 with a signed application. Open to suggestions but, unfortunately, JDK 11 isn't providing an alternative as far as I can tell? @benfry - would you like me to switch out for |
|
I think Might be something we just need to add via JNA, since it should be a single OS call. |
|
I agree. :( |
With the removal of
FileManagerin JDK 9+ we no longer have a means of getting theDocumentsandLibraryfolders on macOS.For now, it's possible to use
System.getProperty("user.home")and tackLibraryorDocumentsonto the end of that, however I'm guessing that it won't be possible in future OS releases, or perhaps even with a signed version of the app, due to security-related changes to how file system access works.(Appending these folder names works now even on localized systems, since the native language shown is not what's used internally by the OS.)