Kroniax_Cpp
Kroniax_Cpp copied to clipboard
Add support for a custom data dir for Linux system installs
An optional KRONIAX_DATADIR parameter can be passed to CMake to initialise a custom data dir (e.g. /usr/share/games/kroniax for system-wide installs on Linux). If the optional parameter is not passed, the data dir defaults to "./data" as previously.
To achieve this, a Helper::getData function has been added in new global.hpp header, which can be accessed from any source file that requires access to data files.
Fixes #16.
Note that I am a C++ newbie, so the way I implemented this feature might not be the best solution you could think of. Feel free to implement it your own way if you prefer, or give me feedback on what I could improve in this PR.
Looks like I was a bit overly optimistic: my PR does allow to put the game data in a custom dir, but if the dir is read-only, only the tutorials can be loaded. I'll open another issue for that.