Skip to content

Commit

Permalink
Ensure [follow_symlinks] does not prepend paths with [./].
Browse files Browse the repository at this point in the history
Signed-off-by: Rodolphe Lepigre <rodolphe@bedrocksystems.com>
  • Loading branch information
Rodolphe Lepigre committed Apr 1, 2022
1 parent 7a9958d commit bb938a9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion otherlibs/stdune/fpath.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ let rec follow_symlinks path =
let parent = Filename.dirname path in
let file = Filename.basename path in
(* If we reached the root, just return the path. *)
if parent = path then Some path
if parent = path then Some path else
if parent = Filename.current_dir_name then
(* Only keep the initial ["."] if it was in the path. *)
if path = Filename.concat Filename.current_dir_name file then
Some path
else
Some file
else
(* Recurse on parent, and re-add toplevel file. *)
match follow_symlinks parent with
Expand Down

0 comments on commit bb938a9

Please sign in to comment.