Author Topic: Saves and logs written to game directory (Linux)  (Read 2588 times)

Chais

  • Posts: 2
  • Maggot Crusher.
    • View Profile
Saves and logs written to game directory (Linux)
« on: September 12, 2014, 09:25:47 AM »
Currently the savegames and log/error files are written to the directory the game resides in.
That behaviour may be acceptable for the Steam version but is ill fitted for the DRM-free version.
With Linux it's a healthy habit to have your installations managed by your distro's package manager. Packages are usually installed systemwide and on a correctly configured system only root can write to most directories outside /home.

So as a packager I have several ways to deal with this:
a) Run the game as root - That's a no-go and probably won't work anyway
b) Give everyone write access to the gamedir - That also is a no-go
c) Create a double indirection with symlinks to actually write to the user's home - The best solution so far, but requires careful link management in the startup script and results in users having access to other users' savegames on multi user systems (ugly)

The perfect solution:
The game stores its configurations in $XDG_CONFIG_HOME/Hammerwatch, which defaults to $HOME/.config/Hammerwatch if $XDG_CONFIG_HOME is unset and the savegames in $XDG_DATA_HOME/Hammerwatch, which defaults to $HOME/.local/share/Hammerwatch if $XDG_DATA_HOME is unset.
This way the game makes sure the user running it can write all necessary files and still gives the user the possibility to store the game's config and saves whereever he wants.