Use XDG paths for config file and user data (saves, screenshots, mods)
As discussed on IRC, we should have a look at using the recommended XDG paths for the config file and for userspace data files (saves, screenshots, potential user-installed mods, though we probably don't support loading them yet from outside the main data dir yet).
There are two environment variables for that, which should be valid at least on Linux (and potentially Mac - and Windows? - too):
XDG_CONFIG_HOME(should default to
~/.config/<name>/on Linux if not defined)
XDG_DATA_HOME(should default to
~/.local/share/<name>/on Linux if not defined)
Here's an example of GPL implementation for this: https://github.com/OpenDungeons/OpenDungeons/blob/48421893b35388ec15741c2fca41bfec215bdd26/source/utils/ResourceManager.cpp#L184
Basically we should:
- Define two variables which will be the config path and the user data path. The former will hold the current
Config.txt, the latter would be the place where screenshots and save files are created. Depending on the platform (or config, it we add a portable mode), it can also point to the same folder.
- For each variable, parse the corresponding env variable. If defined, use it. If not defined or invalid, use a hardcoded value based on the platform:
~/Library/Application Support/<name>/(to be confirmed)
An advantage of this change would be that we'll break compatibility with the legacy Lugaru, so we don't have to bother about config file conflicts (right now Linux and OSX put everything in
~/.lugaru, and Windows in