From de90280aa0895d5b302a3137a3fa1a171a9f127c Mon Sep 17 00:00:00 2001 From: Gaƫtan Gilbert Date: Mon, 18 Jun 2018 14:26:23 +0200 Subject: Fix #7704: get_toplevel_path needs normalised argv.(0) When launched through PATH argv.(0) is just the command name. eg "coqtop -compile foo.v" -> argv.(0) = "coqtop" Using executable_name also follows symlinks but this isn't tested to avoid messing with windows. Running Coq through a symlink is not as important as PATH anyways. --- lib/system.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/system.ml b/lib/system.ml index f109c7192..eef65a4e3 100644 --- a/lib/system.ml +++ b/lib/system.ml @@ -302,7 +302,7 @@ let with_time ~batch f x = raise e let get_toplevel_path top = - let dir = Filename.dirname Sys.argv.(0) in + let dir = Filename.dirname Sys.executable_name in let exe = if Sys.(os_type = "Win32" || os_type = "Cygwin") then ".exe" else "" in let eff = if Dynlink.is_native then ".opt" else ".byte" in dir ^ Filename.dir_sep ^ top ^ eff ^ exe -- cgit v1.2.3