From 24086d1000db370fcf74077841506f02849d0c44 Mon Sep 17 00:00:00 2001 From: Emilio Jesus Gallego Arias Date: Thu, 27 Sep 2018 02:41:18 +0200 Subject: [envars] Small implementation cleanup for coqlib internals. --- lib/envars.ml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'lib') 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 *) -- cgit v1.2.3