@ -28,18 +28,23 @@ let set_env_for_clang_wrapper () =
let () =
let () =
set_env_for_clang_wrapper () ;
set_env_for_clang_wrapper () ;
(* The infer executable in the bin directory is a symbolic link to the real binary in the lib
(* The infer executable in the bin directory is a symbolic link to the real binary in the lib
directory , so that the python script in the lib directory can be found relative to it . * )
directory , so that the python script in the lib directory can be found relative to
it . Packaging may also create longer symlink chains to the real executable , hence the
recursion . * )
let real_exe =
let real_exe =
match Unix . readlink Sys . executable_name with
let rec real_path path =
| link when Filename . is_relative link ->
match Unix . readlink path with
(* Sys.executable_name is a relative symbolic link *)
| link when Filename . is_relative link ->
( Filename . dirname Sys . executable_name ) // link
(* [path] is a relative symbolic link *)
| link ->
real_path ( ( Filename . dirname path ) // link )
(* Sys.executable_name is an absolute symbolic link *)
| link ->
link
(* [path] is an absolute symbolic link *)
| exception Unix . Unix_error ( Unix . EINVAL , _ , _ ) ->
real_path link
(* Sys.executable_name is not a symbolic link *)
| exception Unix . Unix_error ( Unix . EINVAL , _ , _ ) ->
Sys . executable_name
(* [path] is not a symbolic link *)
path
in
real_path Sys . executable_name
in
in
let infer_py = ( Filename . dirname real_exe ) // " python " // " infer.py " in
let infer_py = ( Filename . dirname real_exe ) // " python " // " infer.py " in
let build_cmd = IList . rev Config . rest in
let build_cmd = IList . rev Config . rest in