Skip to content

Commit

Permalink
Merge ROCQPATH and COQPATH instead of only using the first when both …
Browse files Browse the repository at this point in the history
…exist
  • Loading branch information
SkySkimmer committed Jan 8, 2025
1 parent 5a5a300 commit 0a193e5
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/envars.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ let getenv_else s dft =

let getenv_rocq = Boot.Util.getenv_rocq

let getenv_rocq_else s dft =
match getenv_rocq s with
| Some v -> v
| None -> dft ()

let safe_getenv warning n =
getenv_else n (fun () ->
warning ("Environment variable "^n^" not found: using '$"^n^"' .");
Expand Down Expand Up @@ -121,13 +116,15 @@ let configdir () =
if Sys.file_exists path then path else Coq_config.configdir

let coqpath =
let coqpath = getenv_rocq_else "PATH" (fun () -> "") in
let make_search_path path =
let paths = path_to_list path in
let valid_paths = List.filter Sys.file_exists paths in
List.rev valid_paths
in
make_search_path coqpath
let rocqpath = getenv_else "ROCQPATH" (fun () -> "") in
let coqpath = getenv_else "COQPATH" (fun () -> "") in
let () = if coqpath <> "" then warn_deprecated_coq_var ~rocq:"ROCQPATH" ~coq:"COQPATH" () in
make_search_path rocqpath @ make_search_path coqpath

(** {2 Caml paths} *)

Expand Down

0 comments on commit 0a193e5

Please sign in to comment.