XDG Base Directory Specification
WIP, will flesh this out later:
What?
We should consider abiding by the XDG Base Directory Specification
This makes where notion lives on disk configurable, specifically it would abide by the following ENV variables:
-
$XDG_DATA_HOMEfallback:$HOME/.local/share -
$XDG_CONFIG_HOMEfallback:$HOME/.config -
$XDG_DATA_DIRSfallback:/usr/local/share/:/usr/share/ -
$XDG_CONFIG_DIRSfallback:/etc/xdg -
$XDG_CACHE_HOMEfallback:$HOME/.cache -
$XDG_RUNTIME_DIRfallback see [spec]((https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) -
more details for each are specified here*
Why?
- cluttering up $HOME becomes unwieldy
- simplifies testing (we can sub-shell and simply set up the appropriate
$XDGvars (no chroot, containers etc) - easier to reset config / clear caches
- power users can configure to there hearts content, but no cost those who wish to rely on the fallbacks
How
Technically, likely via the XDG crate
Others Using XDG
Mostly just a list of whats in my $XDG_CONFIG_HOME, I suspect there are more.
- nvim: https://github.com/neovim/neovim/pull/3470
- asciinema
- alacritty
- git
- htop
- yarn
- fish
- fisherman
Unresolved
Where do we put stuff in windows?
Maybe something like:
C:\Users\<username>\AppData\Local\notion-cli\notion\{dirs...}
Other Discussion
- rust XDG RFC: https://github.com/rust-lang/rfcs/pull/1615
@stefanpenner Regarding Windows (and macOS) you could have a look at https://crates.io/crates/directories. It's similar to the xdg crate but supports the right directories on Linux, Windows and macOS. (Disclaimer: I wrote it.)