o
odin.langpkg.dev
packages / library / odin-xdg

odin-xdg

ba9d72alibrary

A basic interface to the XDG Base Directory spec

BSD-3-Clause · updated 2 years ago

odin-xdg

This package provides a basic interface for the XDG Base Directory Specification

Provided Procedures

  • config_home() -> (string, Error)
  • cache_home() -> (string, Error)
  • data_home() -> (string, Error)
  • state_home() -> (string, Error)
  • runtime_dir() -> (string, Error)
  • data_dirs() -> ([]string, Error)
  • config_dirs() -> ([]string, Error)

All procedures will return the directories as configured by their relevant environment variables, if set, or the defaults prescribed in the spec otherwise.

Considerations

odin-xdg assumes Linux as the host. I may refactor this to be more portable, but Linux is the primary target.

The runtime_dir procedure requires retrieving the UID in order to calculate the return value (default: /run/user/$UID). To my knowledge (and I did hunt) there is no good documented way to do this in Odin yet. Consequently, odin-xdg relies on some of the deeper parts of core that you won't find in the package docs.

I don't know how likely those parts are to change, though I know gingerBill has some packages in there that are dummy packages for future work. As such, I cannot guarantee that a future update to the language won't unexpectedly break this package. Buyer beware.

License

BSD-3