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] Follow xdg specs or allow user to provide directories #2285

Closed
romatthe opened this issue Dec 27, 2022 · 11 comments
Closed

[Linux] Follow xdg specs or allow user to provide directories #2285

romatthe opened this issue Dec 27, 2022 · 11 comments

Comments

@romatthe
Copy link

romatthe commented Dec 27, 2022

First of all, thanks for making this great project and thanks for supporting it on Linux.

I finally got the Ship to build on my machine today after some CMake issues, and the first thing I noticed was the somewhat weird way in which all files are handled.

The game expects all assets to be stored alongside the soh binary (or, well, be in the working directory at least) and also stores all save data AND configuration files AND the gamecontrollerdb.txt file alongside it (or, again, the current working directory).

On Linux, this is actually pretty inconvenient. I know this may not sound like a big issue, since most users likely use Windows and most Linux users probably use the AppImage anyway. For everyone else though, it's rather annoying.

For example, I personally use NixOS (which sharply increases the obscurity of my use case even further, but please here me out). I won't dig in to the details, but on this distro you essentially have to package all software using its own system, and all packaged software gets stored in a read-only repository on your machine. So right away this is a bit conflicting, as I can't write save data or configuration files there. (Moreover, AppImages aren't well supported on my distro)

This is not exclusively a Linux problem of course, in Windows-land I assume that configuration data and save data should probably be located in %APPDATA% as well or something. But it's even more annoying on Linux where we usually keep binaries in a a seperate store (like /usr/bin or a read-only store like in my case).

My proposal is rather modest: it would be nice if Linux builds would follow the xdg spec at least loosely and keep configuration and save data in one of the classic directories (Somewhere under ~/.config is already really nice, though technically save data etc should go somewhere under ~/.local, but let's keep things simple for now). If the location of the assets directory and oot.otr file can be overwritten by specifying them on the command line or in a config file in the previously mentioned config directory, that would be even better. And this change could go hand-in-hand with maybe placing save data in a more appropriate location for Windows as well.

Sorry for the rambling explanation, hopefully my point is clear.

@briaguya-ai
Copy link
Contributor

This seems like a dupe of #381

I get the impression this should be possible as of #572, and I think someone else did some nix packaging stuff too but I couldn't find a PR

@RaelCappra
Copy link
Contributor

This isn't a dupe of #381. While the introduction of the App Directory Path does help, it doesn't fully address the issue in the current implementation: the config files, saves, mods and assets are all assumed to be in the same working directory as the binary. There is work in progress for a nix package, though, with a pull request in NixOS/nixpkgs#207770. You can follow the discussion on the Discord thread about the nix package, under support.

@dcvz
Copy link
Contributor

dcvz commented Dec 27, 2022

While my PR #572 does not fix this for Linux -- this follow-on was meant to address this: #1210

on macOS there's a standard place to save files like this, is there one that's true for most Linux distros?

@briaguya-ai
Copy link
Contributor

config files, saves, mods and assets are all assumed to be in the same working directory as the binary

not with SHIP_HOME set #1210

@briaguya-ai
Copy link
Contributor

sidenote, i don't think we should follow the spec by default until we have a "open config/mods/etc. directory" button in soh itself. a large number of linux users are on deck and new to linux, trying to explain how to find config/spoiler logs/save files would be a lot harder than it is now if they lived in hidden dirs as per xdg guidelines

@j0lol
Copy link

j0lol commented Dec 28, 2022

one of the nixos packagers here, having a separate configurable directory for configs, saves, and another directory for OTRs would mean we wouldn't have to patch.

@IvarWithoutBones
Copy link

one of the nixos packagers here, having a separate configurable directory for configs, saves, and another directory for OTRs would mean we wouldn't have to patch.

Yeah, having a configurable way to split directories soh mutably writes to and the immutable compile assets like the OTRs would be very benefitial.

@dcvz
Copy link
Contributor

dcvz commented Dec 30, 2022

@j0lol @IvarWithoutBones so does this not help you all? #2285 (comment)

@briaguya-ai
Copy link
Contributor

@j0lol @IvarWithoutBones so does this not help you all? #2285 (comment)

i'd assume not, since SHIP_HOME is assumed to be one directory with everything, we'd need different dirs for saves/configs vs otrs etc.

@IvarWithoutBones
Copy link

It does help a fair bit by reducing the number of patches we need. The current derivation (NixOS packaging solution) by @j0lol unfortunately does still need a patch to look for the OTRs in a compile-time configurable immutable directory though, so our needs are not completely fulfilled with it.

@briaguya-ai
Copy link
Contributor

i think this was resolved by #3119, if there's more that's needed for it i can reopen

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

6 participants