package directories

  1. Overview
  2. Docs
An OCaml library that provides configuration, cache and data paths (and more!) following the suitable conventions on Linux, macOS and Windows

Install

Dune Dependency

Authors

Maintainers

Sources

0.6.tar.gz
sha256=9a0730b92aef52d04c7b4bbb1afc8aa0b4f65a1d8f171e328094c49aeb3ec889
sha512=b0335b35b4ca3d3b2142aa2810977c975c92b56064dbed9a9c70bc05c7e87d9e72aac5aae518f6ff285e01dbbe846b3950b165cd65833261e45eeafd562f2b26

Description

directories is an OCaml library that provides configuration, cache and data paths (and more!) following the suitable conventions on Linux, macOS and Windows. It is inspired by similar libraries for other languages such as directories-jvm. The following conventions are used: XDG Base Directory Specification and xdg-user-dirs on Linux, Known Folders on Windows, Standard Directories on macOS.

Published: 30 Jan 2025

README

directories

directories is an OCaml library that provides configuration, cache and data paths (and more!) following the suitable conventions on Linux, macOS and Windows. It is inspired by similar libraries for other languages such as directories-jvm.

The following conventions are used:

On Linux and macOS it has no dependency. On Windows, it depends only on ctypes.

Quickstart

You should depend on directories then :

let () =
  let module App_id = struct
    let qualifier = "com"
    let organization = "YourCompany"
    let application = "yourapp"
  end in
  let module M = Directories.Project_dirs (App_id) in
  let option_value = function None -> "None" | Some v -> v in
  Format.printf "cache dir  = `%s`@." (option_value M.cache_dir);
  Format.printf "config dir = `%s`@." (option_value M.config_dir);
  Format.printf "data dir   = `%s`@." (option_value M.data_dir)

For more, have a look at the example folder.

About

Dependencies (4)

  1. fpath
  2. ctypes >= "0.17.1" & (os = "win32" | os = "cygwin")
  3. ocaml >= "4.14.0"
  4. dune >= "2.1"

Dev Dependencies

None

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.