Fix lookup in XDG locations#77
Conversation
|
@smcv, is this expected usage? |
I'm not sure what you're asking me. @pinotree, perhaps you could give a solution-neutral problem statement for the bug you're fixing, or the enhancement you're asking for? That would make it easier to assess whether this PR is the right implementation. The canonical spec for the XDG locations is: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html The main thing that people sometimes miss is that if a particular sort of data is looked up in
And the config "stack" is very similar to the data "stack", but with different environment variable names and defaults. A few specifications like Vulkan use both "stacks", one after the other. It's also OK for resources to only be looked up in the app's installed directory (conventionally hard-coded at build time on Unix, but might also be looked up relative to the executable), for example perhaps in The subdirectory can be anything you want, within reason. I'd normally expect |
As I mentioned, there is a mismatch between what Regarding the system locations: Line 259 in 0d7a850 Considering that ${PROJECT_NAME} is "Maelstrom", then the current lookup of a lowercase "maelstrom" done by GetXDGDataPath() does not find any resources in $XDG_DATA_DIRS at all. This can be easily checked with strace over a system installation of Maelstrom (installed in /usr, so that /usr/share/Maelstrom/Data/ exists):
Using the predefined name (passed to Lines 52 to 53 in 0d7a850 Regarding the user local directory:
May seem unusual, however that is what SDL (at least in v3) does. Maelstrom calls https://github.com/libsdl-org/SDL/blob/main/src/filesystem/unix/SDL_sysfilesystem.c#L274-L335 Indeed, my scores and preferences are in |
Make use of the existing project name to lookup resources, matching what is used to install them. Additionally, user resources are "namespaced" using the organization name too. This makes it possible to provide own data & mods in the user local directory without changing the system installation.
|
It seems reasonable for the Data override to share the same directory as the scores and preferences. I'll go ahead and accept this PR, thanks! |
Make use of the existing project name to lookup resources, matching what is used to install them. Additionally, user resources are "namespaced" using the organization name too.
This makes it possible to provide own data & mods in the user local directory without changing the system installation.