-
-
Notifications
You must be signed in to change notification settings - Fork 122
Description
In porting my application from PhysicsFS 2 to 3, I've run into the deprecation of PHYSFS_getUserDir. The suggested replacement, PHYSFS_getPrefDir, is not always the appropriate one. Of course, it could be that I'm doing stuff wrong.
Missing distinction between configuration and data
First of all, my application distinguishes between configuration and (writable) data. On Linux, it uses the following locations:
Configuration: PHYSFS_getUserDir() + "/.config/org/app"
Data: PHYSFS_getUserDir() + "/.local/share/app"
Only for the latter can I use PHYSFS_getPrefDir, though it's not the directory I had expected for a function with "Pref" in its name.
The situation is similar for Haiku, which distinguishes between configuration at /config/settings and data at /config/data (but PhysicsFS uses /config/settings here).
And there is Windows, where PHYSFS_getPrefDir is based on the folder CSIDL_APPDATA, but this is the roaming variant, whereas in our app we'd want CSIDL_LOCAL_APPDATA for the data.
Since in fact PHYSFS_getUserDir can only provide part of the functionality here, the solution might be to add a PHYSFS_getLocalDataDir, which would return a suitable path for storing local data, as opposed to user preferences.
Other user-cases
-
We used to store configuration and data in
~/.app, and we still support migrating old config from there.PHYSFS_getUserDirwas useful for this purpose. -
Our app supports saving of screenshots, which we currently put in
PHYSFS_getUserDir() + "Desktop"by default. This is obviously a case of "you're doing it wrong" because this path is subject to localization and might not make sense at all, of course. On Windows we try to useCSIDL_MYPICTURESandCSIDL_DESKTOPhere, but I'm not sure it makes sense for PhysicsFS to abstract all these locations.
Either way, I think to be able to get the base user directory in a platform-agnostic way remains useful.