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.3.tar.gz
sha256=9b37d1d43e3b06f3b68ebe57651ea2cf5a9db6d5bdb1a0afe65786bcdcc8bf11
sha512=9d1634a0c44dd74dc3005154ebbc22c39bb0c3e1477f3e67c9fc49cc32059ac0f496816c06785f204f60ee67136c998f526ba0c9bf4232d040ff30bd89411fb3

README.md.html

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

OCaml

Innovation. Community. Security.