xdg-basedir-compliant: XDG Basedir

[ bsd3, library, system ] [ Propose Tags ] [ Report a vulnerability ]

See README.md


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 1.0.2, 1.1.0, 1.2.0
Change log CHANGELOG
Dependencies base (>=4.7 && <5), bytestring, containers, directory, filepath, path, polysemy, polysemy-plugin, polysemy-zoo, split [details]
License BSD-3-Clause
Copyright 2022–2023 Pierre Thierry
Author Pierre Thierry
Maintainer pierre@nothos.net
Category System
Home page https://github.com/kephas/xdg-basedir-compliant#readme
Bug tracker https://github.com/kephas/xdg-basedir-compliant/issues
Source repo head: git clone https://github.com/kephas/xdg-basedir-compliant
Uploaded by kephasp at 2023-01-01T19:07:55Z
Distributions
Downloads 204 total (6 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-01-01 [all 1 reports]

Readme for xdg-basedir-compliant-1.2.0

[back to package description]

XDG Basedir implementation

This is a compliant implementation of the XDG Base Directory Specification.

Compliance

  • $XDG_DATA_HOME
    • get path
    • read file
    • write file
  • $XDG_CONFIG_HOME
    • get path
    • read file
    • write file
  • $XDG_STATE_HOME
    • get path
    • read file
    • write file
  • $XDG_DATA_DIRS
    • get path list
    • read best file
    • merge files
  • $XDG_CONFIG_DIRS
    • get path list
    • read best file
    • merge files
  • $XDG_CACHE_HOME
    • get path
    • read file
    • write file
  • $XDG_RUNTIME_DIR
    • get path
    • read file
    • write file
  • treat relative paths as invalid

As this library deals purely with accessing files, I eventually chose not to implement the notion of warning the user when $XDG_RUNTIME_DIR isn't set and of providing a replacement directory. Any application where that behaviour would be relevant can use the exception raised by getRuntimeDir to detect this problem, should deal with warning the user in its own context, and can set $XDG_RUNTIME_DIR with a path that makes sense for that application.

Build

You can build the project with:

hpack
cabal build

If you have Nix installed, shell.nix provides an environment with all the needed dependencies. It is suitable for nix-direnv.