Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider deprecation of PHYSFS_getUserDir, or maybe add PHYSFS_getLocalDataDir #75

Open
bjorn opened this issue Feb 6, 2024 · 1 comment

Comments

@bjorn
Copy link

bjorn commented Feb 6, 2024

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_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.

@bjorn
Copy link
Author

bjorn commented Feb 15, 2024

I see this was already mentioned at #41:

Queries for other writeable directories (config/cache/etc), instead of just a "pref path"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant