Support modern locations for configuration files for Unix (XDG_CONFIG_HOME and ~/.config/)#41
Support modern locations for configuration files for Unix (XDG_CONFIG_HOME and ~/.config/)#41Ma11ock wants to merge 1 commit intoDarkPlacesEngine:masterfrom
Conversation
|
I think XDG support should include putting the Please add a --signoff to your commit(s) (to clarify you are releasing the code as GPLv2+). @Cloudwalk9 is there anything else that needs to be changed at the same time? |
|
Marking as Draft as it can't be merged in the current state. |
| { | ||
| dpsnprintf(userdir, userdirsize, "%s/.%s/", homedir, gameuserdirname); | ||
| #if defined(__unix__) || defined(__unix) | ||
| // Check for darkplaces config paths in this order: ~/.darkplaces, XDG_CONFIG_HOME/darkplaces, ~/.config/darkplaces. |
There was a problem hiding this comment.
This encodes a preference order. It prefers ~/.darkplaces if it exists, but creates ~/.config/darkplaces if nothing exists. Please explain this in the comment.
| if(access(userdir, F_OK) != 0) | ||
| { | ||
| // Check if XDG_CONFIG_HOME exists, test if absolute path. | ||
| const char *xdgconfdir = getenv("XDG_CONFIG_HOME"); |
There was a problem hiding this comment.
Note that XDG_CONFIG_HOME may be put on version control, and thus is not appropriate for in particular the dlcache subdirectory.
Any chance that can be fixed first?
There was a problem hiding this comment.
Failing that, I guess ~/.local/share/darkplaces won't be wrong, but also not substantially better.
Modern Linux/BSD systems have moved their configuration files out of the home directory and into ~/.config, or the directory pointed to by the environment variable XDG_CONFIG_HOME. This patch adds support for these directories. Tested on Linux and Windows.