package ocaml-xdg-basedir

  1. Overview
  2. Docs
xdg-basedir specification implementation

Install

Dune Dependency

Authors

Maintainers

Sources

ocaml-xdg-basedir-0.0.3.tar.gz
sha256=0b2bdead251d686fee43e478c2aebb84a8e4af90011bdc8bd29870b37dcd66b3
md5=68367eba73f6094fea8c6ffee0072e20

doc/xdg-basedir/XDGBaseDir/index.html

Module XDGBaseDir

XDG basedir implementation

The XDG basedir specification makes clear where to store configuration, cache and data files. This a way to maintain a clean $HOME. Locations can be customized through environment variables (XDG_DATA_HOME, XDG_CONFIG_HOME). It also allows to store files in several places (i.e. system directories).

  • author Sylvain Le Gall

Types

type filename = string
type dirname = string
type dirnames = dirname list
type t = {
  1. data_home : dirname;
    (*

    $HOME/.local/share

    *)
  2. data_dirs : dirnames;
    (*

    /usr/share

    *)
  3. config_home : dirname;
    (*

    $HOME/.config

    *)
  4. config_dirs : dirnames;
    (*

    /etc/xdg

    *)
  5. cache_home : dirname;
    (*

    $HOME/.cache

    *)
}

XDG environment

Modules and functions

val default : t

Default XDG environment

val mkdir_openfile : (filename -> 'a) -> filename -> 'a

mkdir_openfile f fn Create parent directory of fn and apply f fn

module Data : sig ... end

In this module, ~xdg_env allows to override the default XDG environment. If you use ~exists:true, the files/dirs are tested for existence.

module Config : sig ... end

See Data for explanations about ~xdg_env and ~exists

module Cache : sig ... end

See Data for explanations about ~xdg_env and ~exists

OCaml

Innovation. Community. Security.