| 1 | (************************************************************************) |
| 2 | (* * The Rocq Prover / The Rocq Development Team *) |
| 3 | (* v * Copyright INRIA, CNRS and contributors *) |
| 4 | (* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 | (* \VV/ **************************************************************) |
| 6 | (* // * This file is distributed under the terms of the *) |
| 7 | (* * GNU Lesser General Public License Version 2.1 *) |
| 8 | (* * (see LICENSE file for the text of the license) *) |
| 9 | (************************************************************************) |
| 10 | |
| 11 | (** This file provides a high-level interface to the environment variables |
| 12 | needed by Rocq to run (such as coqlib). The values of these variables |
| 13 | may come from different sources (shell environment variables, |
| 14 | command line options, options set at the time Rocq was build). *) |
| 15 | |
| 16 | val getenv_rocq : string -> string option |
| 17 | (** [getenv_rocq name] returns the value of "ROCQ$name" if it exists, |
| 18 | otherwise the value of "COQ$name" if it exists and warns that it |
| 19 | is deprecated, otherwise [None]. *) |
| 20 | |
| 21 | (** [expand_path_macros warn s] substitutes environment variables |
| 22 | in a string by their values. This function also takes care of |
| 23 | substituting path of the form '~X' by an absolute path. |
| 24 | Use [warn] as a message displayer. *) |
| 25 | val expand_path_macros : warn:(string -> unit) -> string -> string |
| 26 | |
| 27 | (** [home warn] returns the root of the user directory, depending |
| 28 | on the OS. This information is usually stored in the $HOME |
| 29 | environment variable on POSIX shells. If no such variable |
| 30 | exists, then other common names are tried (HOMEDRIVE, HOMEPATH, |
| 31 | USERPROFILE). If all of them fail, [warn] is called. *) |
| 32 | val home : warn:(string -> unit) -> string |
| 33 | |
| 34 | (** [datadir] is the path to the installed data directory. *) |
| 35 | val datadir : unit -> string |
| 36 | |
| 37 | (** [configdir] is the path to the installed config directory. *) |
| 38 | val configdir : unit -> string |
| 39 | |
| 40 | (** [coqpath] is the standard path to coq. |
| 41 | Notice that coqpath is stored in reverse order, since that is |
| 42 | the order it gets added to the search path. *) |
| 43 | val coqpath : unit -> string list |
| 44 | |
| 45 | (** Rocq tries to honor the XDG Base Directory Specification to access |
| 46 | the user's configuration files. |
| 47 | |
| 48 | see [http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html] |
| 49 | *) |
| 50 | val xdg_config_home : (string -> unit) -> string |
| 51 | val xdg_data_home : (string -> unit) -> string |
| 52 | val xdg_data_dirs : (string -> unit) -> string list |
| 53 | val xdg_dirs : warn : (string -> unit) -> string list |