Skip to content

Follow XDG Base Directory Specification for Linux #371

Description

@SVendittelli

Problem

On Linux, the database, log, and config files are all being stored in $XDG_DATA_HOME which doesn't follow the XDG Base Directory Specification.

Proposed solution

There is no issue with any of these files being stored in a slumber subdirectory of the following proposed locations.

The database file (state.sqlite) should be stored in the dirs::data_dir, as it currently is, no change needed.

The config file (config.yml) should be stored in dirs::config_dir. This points to the same location on macOS and Windows, so would be backwards compatible for those platforms, but would be different for Linux (i.e. $XDG_CONFIG_HOME not $XDG_DATA_HOME). This would be a breaking change.

The log file (slumber.log) is more tricky. According to the spec, this should be stored in $XDG_STATE_HOME on Linux, provided by dirs::state_dir. However, this does not have Windows and macOS equivalents in the dirs crate. For Windows and macOS, the dirs::cache_dir would be an acceptable fallback. This would be a breaking change.

Additional context

  1. XDG Base Directory Specification
  2. dirs crate

Activity

  1. LucasPickering commented on Sep 8, 2024

    @LucasPickering
    Owner

    Thanks for the detailed report. To be honest, I didn't put a ton of thought into the directory locations, I just pulled in dirs and ran with it. I'm happy to make this change. I have no problem moving the log files without considering it a breaking change, because I don't think anyone has any level of automation or workflows built off the log files. In fact this is the first time anyone other than me has acknowledged their existence.

    For the config change, to keep it backward compatible we can just continue to check the old location, but suggest the new location in documentation/command output.

  2. SVendittelli commented on Sep 8, 2024

    @SVendittelli
    ContributorAuthor

    That all sounds great to me, thanks for considering it.

  3. added a commit that references this issue on Sep 17, 2024
    94dc667
  4. added a commit that references this issue on Oct 13, 2024
  5. added a commit that references this issue on Dec 22, 2024
    1d9387b
  6. added a commit that references this issue on May 11, 2026
  7. added a commit that references this issue on May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions