On Apr 8, 2010, at 2:37 PM, Joel Uckelman wrote:
Yeah, I thought it would be something like that.
If one wanted to be fully consistent with Mac practices, the Preferences would be stored in ~/Library/Preferences directory, presumable under a Vassal subdirectory. Other preference information could go there. Other files that the application needs would be traditionally stored in ~/Library/Application Support/Vassal
Except from developer.apple.com/Mac/library/ … aAPIs.html
===== begin quote ====
"Preferences
The Preferences API is fully supported in Mac OS X, but there are two details you should be aware of to provide the best experience to users:
• The preferences files generated by the Preferences API are named com.apple.java.util.prefs. The user’s preferences file is stored in their home directory (~/Library/Preferences/). The system preferences are stored in/Library/Preferences/ and are only persisted to disk if the user is an administrator.
• To be consistent with the Mac OS X user experience, your preferences should be available from the application menu. The com.apple.eawt.Application class provides a mechanism for doing this. See J2SE 5.0 Apple Extensions Reference for more information."
===== end quote ====
More about the Library and Application Support directories.
Basic background:
developer.apple.com/mac/library/ … Files.html
Here’s a nice little cross-platform discussion of application support issues with some sample code:
forums.sun.com/thread.jspa?threadID=5386564
the only thing that isn’t covered by this is what to do on non-English operating system installations. It looks like that is handled on the Mac by the
com.apple.eio.FileManager
class with its static findFolder function. It would seem that this should work for both the Preferences and Application Support folders, although the javadocs maddeningly enough don’t seem to give the list of allowable folderType codes. These must be constants somewhere, but I’m having trouble locating them.
Let’s see what I can find.
It seems that the best solution is to call
com.apple.eio.FileManager(com.apple.eio.FileManager.kUserDomain,
???,
true)
which will return the appropriate directory string for the user, creating it if necessary. The problem is finding the proper integers to pass for the folder types. I couldn’t find it in the Apple documentation anywhere, but I did find an email from the Java dev list that pretty much reverse engineered it from the C sources:
lists.apple.com/archives/java-de … 00612.html
which show 0x61737570 for Application Support, 0xx70726566 for Preferences and 0xx74656D70 for Temp.
Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org
Post generated using Mail2Forum (mail2forum.com)