Skip to content

Commit

Permalink
Merge pull request #3697 from mtzguido/realpath
Browse files Browse the repository at this point in the history
FStarC.Util: make sure executable_name and exec_dir point to concrete…
  • Loading branch information
mtzguido authored Jan 24, 2025
2 parents b908f09 + dbeb7aa commit 7cd06c5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ml/bare/FStarC_Util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,13 @@ let incr r = r := Z.(!r + one)
let decr r = r := Z.(!r - one)
let geq (i:int) (j:int) = i >= j

let exec_name = Sys.executable_name
let get_exec_dir () = Filename.dirname (Sys.executable_name)
(* Note: If F* is called invoked via a symlink, executable_name contains
the name of the unresolved link in macos (not so in Linux). Since
F* needs to find its library relative to the path of its installed
executable, we must resolve all links, so we use realpath. *)
let exec_name = Unix.realpath Sys.executable_name

let get_exec_dir () = Filename.dirname exec_name
let get_cmd_args () = Array.to_list Sys.argv
let expand_environment_variable x = try Some (Sys.getenv x) with Not_found -> None

Expand Down

0 comments on commit 7cd06c5

Please sign in to comment.