Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gardenappl opened this issue Nov 9, 2020 · 0 comments

Comments

@gardenappl
Copy link

gardenappl commented Nov 9, 2020

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 gardenappl changed the title Linux build should implement XDG Base Directory (don't save files in installation folder) Linux version implement XDG Base Directory (don't save files in installation folder) Nov 9, 2020
@gardenappl gardenappl changed the title Linux version implement XDG Base Directory (don't save files in installation folder) Linux version should implement XDG Base Directory (don't save files in installation folder) Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant