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

Consider using XDG Base Directory Specification on Linux #299

Open
PenitentMonke opened this issue Jan 10, 2024 · 1 comment
Open

Consider using XDG Base Directory Specification on Linux #299

PenitentMonke opened this issue Jan 10, 2024 · 1 comment

Comments

@PenitentMonke
Copy link

Both config.json and history.sqlite3 are currently saved inside the same .nhentai directory, which is created directly under the user's home directory.

To many users, me included, this isn't ideal. We try to keep our $HOME clean, for as many reasons as there are people doing it. Developers can help us a lot in this regard by following the XDG Base Directory Specification.

I'm asking that the developers of this repository consider following it as well.

I'd like to help make this change, be it by sending a PR or answering any questions to the best of my ability.

Here's some information that might be useful, from my understanding of the software and the spec:

  • config.json should go to $XDG_CONFIG_HOME/nhentai/ OR $XDG_DATA_HOME/nhentai/
    • I say or, because its behavior is strange for a configuration file. Some properties are changed frequently using the command line. Maybe it should be split into separate files? But that's a different discussion.
  • history.sqlite3 should go to $XDG_DATA_HOME/nhentai/
  • This shouldn't be a disruptive change to most users if we try locations in order of priority:
    • Is $XDG_(CONFIG/DATA)_HOME environment set and nhentai/filename exists inside it? If so, use that.
    • Does $HOME/.nhentai/filename exist? If so, use that.
    • When no file is found, create it under the appropriate location, depending on whether XDG vars are set.
    • Users who care about XDG spec can manually move the files if needed.

I don't see how this could affect Windows users, but it should be possible to enable this behavior only on Linux, if that's a concern. I'd argue these files don't belong in User\.nhentai\ on Windows either, if that's what's currently happening, but I don't know if it makes sense to increase the scope of this issue to include another OS.

See Arch wiki - XDG Base Directory for a list of how different software handle this issue. I also like how Wezterm does it.

@RicterZ
Copy link
Owner

RicterZ commented Jan 16, 2024

PRs are welcome :)

PenitentMonke pushed a commit to PenitentMonke/xdg-base-dir that referenced this issue Jan 30, 2024
Set NHENTAI_HOME to $XDG_DATA_DIR/nhentai, if possible.

REF: RicterZ#299
PenitentMonke pushed a commit to PenitentMonke/xdg-base-dir that referenced this issue Jan 30, 2024
Set NHENTAI_HOME to $XDG_DATA_DIR/nhentai, if possible.

REF: RicterZ#299
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

2 participants