haskell / directory

Platform-independent library for basic file system operations
https://hackage.haskell.org/package/directory
Other
58 stars 47 forks source link

XDG basedir spec 0.8 #119

Open phadej opened 3 years ago

phadej commented 3 years ago

https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

It adds: There is a single base directory relative to which user-specific state data should be written. This directory is defined by the environment variable$XDG_STATE_HOME.

It would be great that plural $XDG_CONFIG_DIRS and $XDG_DATA_DIRS were supported as well.

I really don't like how https://github.com/haskell/directory/issues/93 for XDG_RUNTIME_DIR was resolved I'll comment there more.

Rufflewind commented 3 years ago

Current status:

trskop commented 3 years ago

Spec v0.8 also introduced ~/.local/bin. There just isn't an environment variable override for it.

It seems that they are slowly adopting Systemd's file-hierarchy(7), which already did define ~/.local/bin. I'm guessing that they will adopt ~/.local/lib too in the future.

I'd be happy to help with ~/.local/bin, maybe as XdgBin?

Regarding XDG_RUNTIME_DIR, the usual default on UNIX-like systems is temp directory as it provides similar guarantees via sticky bit. See https://serverfault.com/questions/388840/good-default-for-xdg-runtime-dir.

Rufflewind commented 3 years ago

XdgBin sounds fine for ~/.local/bin if there is a need for it.