aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2018-09-27 02:41:18 +0200
committerEmilio Jesus Gallego Arias2018-10-01 05:00:01 +0200
commit24086d1000db370fcf74077841506f02849d0c44 (patch)
tree10418b37387ed49fb13d8bc11616a370878f1523 /lib
parent9d3a2d042500094befe4b88f3aa73693bc287ed9 (diff)
[envars] Small implementation cleanup for coqlib internals.
Diffstat (limited to 'lib')
-rw-r--r--lib/envars.ml19
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/envars.ml b/lib/envars.ml
index 12cc9edfe4..cf76b6ebc8 100644
--- a/lib/envars.ml
+++ b/lib/envars.ml
@@ -105,22 +105,19 @@ let guess_coqlib fail =
fail "cannot guess a path for Coq libraries; please use -coqlib option")
)
-(** coqlib is now computed once during coqtop initialization *)
-
-(* Options for changing coqlib *)
-let coqlib_spec = ref false
-let coqlib = ref "(not initialized yet)"
+let coqlib : string option ref = ref None
+let set_user_coqlib path = coqlib := Some path
-let set_user_coqlib path =
- coqlib_spec := true;
- coqlib := path
+(** coqlib is now computed once during coqtop initialization *)
let set_coqlib ~fail =
- if not !coqlib_spec then
+ match !coqlib with
+ | Some _ -> ()
+ | None ->
let lib = if !Flags.boot then coqroot else guess_coqlib fail in
- coqlib := lib
+ coqlib := Some lib
-let coqlib () = !coqlib
+let coqlib () = Option.default "" !coqlib
let docdir () =
(* This assumes implicitly that the suffix is non-trivial *)