Module Filepath

module Filepath: sig .. end

Functions manipulating filepaths. In these functions, references to the current working directory refer to the result given by function Sys.getcwd.


val normalize : ?base_name:string -> string -> string

Returns an absolute path leading to the given file. The result is similar to realpath --no-symlinks. Some special behaviors include:

val relativize : ?base_name:string -> string -> string

relativize base_name file_name returns a (strict) relative path name of file_name w.r.t. base_name, if base_name is a prefix of file; otherwise, returns file_name unchanged. The default base name is the current working directory name.

val is_relative : ?base_name:string -> string -> bool

returns true if the file is strictly relative to base (that is, it is prefixed by base_name), or to the current working directory if no base is specified.

val pretty : string -> string

Pretty-print a path according to these rules:

val add_symbolic_dir : string -> string -> unit

add_symbolic_dir name dir indicates that the (absolute) path dir must be replaced by name when pretty-printing paths. This alias ensures that system-dependent paths such as FRAMAC_SHARE are printed identically in different machines.