Remove redundant code computing initial working directory

Summary:
Now that the toplevel driver's cwd is passed through realpath, the
dance to preserve symlinks is redundant.

Reviewed By: jeremydubreil

Differential Revision: D4371055

fbshipit-source-id: c8aebaf
master
Josh Berdine 8 years ago committed by Facebook Github Bot
parent 8d143d87df
commit 9f30059397

@ -298,21 +298,7 @@ let init_work_dir, is_originator =
| Some dir -> | Some dir ->
(dir, false) (dir, false)
| None -> | None ->
let cwd = let real_cwd = Utils.realpath (Sys.getcwd ()) in
(* Use PWD if it denotes the same inode as ., to try to avoid paths with symlinks resolved *)
(* Approach is borrowed from llvm implementation of *)
(* llvm::sys::fs::current_path (implemented in Path.inc file) *)
match Sys.getenv "PWD" with
| Some pwd ->
let pwd_stat = Unix.stat pwd in
let dot_stat = Unix.stat "." in
if pwd_stat.st_dev = dot_stat.st_dev && pwd_stat.st_ino = dot_stat.st_ino then
pwd
else
Sys.getcwd ()
| None ->
Sys.getcwd () in
let real_cwd = Utils.realpath cwd in
Unix.putenv ~key:"INFER_CWD" ~data:real_cwd; Unix.putenv ~key:"INFER_CWD" ~data:real_cwd;
(real_cwd, true) (real_cwd, true)

Loading…
Cancel
Save