SSVOpenHexagon icon indicating copy to clipboard operation
SSVOpenHexagon copied to clipboard

Linux version should implement XDG Base Directory (don't save files in installation folder)

Open gardenappl opened this issue 4 years ago • 0 comments

I've been doing a bit of work and I managed to create an Arch User Repository package for Open Hexagon: open-hexagon-git. The end goal here is to allow Linux users to install the game with just one command (ex. yay open-hexagon-git) and it will simply get installed in the system-wide directory /usr/lib/open-hexagon, just like all other Linux software.

The problem is, /usr/lib/ is owned by root and is typically "read-only" for regular users. This means that, unless you run Open Hexagon with root privileges, it won't be able to save any data and will actually crash. I've done some workarounds for this (you can look at the package's PKGBUILD), but it's a very ugly solution.

The way pretty much every other Linux program solves this is by saving all data somewhere in the user's home folder. Configuration data is saved to $XDG_CONFIG_HOME (or ~/.config) and state data is saved to $XDG_DATA_HOME (or ~/.local/share)

I suggest that you do the same. Maybe first try to read files from the installation directory, for backwards compatibility, but for new users, all save files should follow the XDG standard. Configs, including custom Packs, should be in the config dir, and things like logs and replays could be in the data dir.

I've been looking around and it looks like @flibitijibibo had already provided a solution a while ago (https://gist.github.com/flibitijibibo/5139524)

gardenappl avatar Nov 09 '20 07:11 gardenappl