You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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_getUserDir was 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 use CSIDL_MYPICTURES and CSIDL_DESKTOP here, 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.
The text was updated successfully, but these errors were encountered:
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:
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 folderCSIDL_APPDATA
, but this is the roaming variant, whereas in our app we'd wantCSIDL_LOCAL_APPDATA
for the data.Since in fact
PHYSFS_getUserDir
can only provide part of the functionality here, the solution might be to add aPHYSFS_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_getUserDir
was 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_MYPICTURES
andCSIDL_DESKTOP
here, 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.
The text was updated successfully, but these errors were encountered: