Normalize TV paths to avoid render errors

Reviewed By: jvillard

Differential Revision: D26046174

fbshipit-source-id: c57273045
master
Martin Trojer 4 years ago committed by Facebook GitHub Bot
parent 7e4dc9477e
commit faaf0ecf18

@ -135,6 +135,8 @@ let normalize_path_from ~root fname =
(filename_of_rev_parts rev_result, filename_of_rev_parts rev_root)
let normalize_path fname = fname |> normalize_path_from ~root:"." |> fst
(** Convert a filename to an absolute one if it is relative, and normalize "." and ".." *)
let filename_to_absolute ~root fname =
let abs_fname = if Filename.is_absolute fname then fname else root ^/ fname in

@ -26,6 +26,9 @@ val normalize_path_from : root:string -> string -> string * string
the result is [("../foo/bar", ".")] (in particular "r/a/../../../foo/./bar" and "./../foo/bar"
represent the same file) *)
val normalize_path : string -> string
(** Normalize a path without a root *)
val filename_to_absolute : root:string -> string -> string
(** Convert a filename to an absolute one if it is relative, and normalize "." and ".." *)

Loading…
Cancel
Save