package directories
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=3eb8e0d079fd7c1099e9b92f8569b4edfb313fe58e838443a38266bd47d38c53
sha512=93ced24f1e1c1ea0cb90237b7c6deb417274b15a9363039801e6300b07523964c2abb8670d8560d2fb74c8f9c27813a6969da8bdfe47c586acb3d9ebf1fba905
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: 09 Jan 2022
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:
XDG Base Directory Specification and xdg-user-dirs on Linux
Known Folders on Windows
Standard Directories on macOS
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.