module FilePath:Operations on abstract filenames.sig
..end
This module allow to manipulate string or abstract representation of a filename.
Abstract representation of a filename allow to decode it only once, and should speed up further operation on it (comparison in particular). If you intend to do a lot of processing on filename, you should consider using its abstract representation.
This module manipulate abstract path that are not bound to a real filesystem.
In particular, it makes the assumption that there is no symbolic link that
should modify the meaning of a path. If you intend to use this module
against a real set of filename, the best solution is to apply to every
filename to solve symbolic link through FileUtil.readlink
.
Author(s): Sylvain Le Gall
typefilename =
string
typeextension =
string
exception BaseFilenameRelative of filename
exception UnrecognizedOS of string
exception EmptyFilename
exception NoExtension of filename
exception InvalidFilename of filename
val is_subdir : filename -> filename -> bool
is_subdir fl1 fl2
Is fl2
a sub directory of fl1
val is_updir : filename -> filename -> bool
is_updir fl1 fl2
Is fl1
a sub directory of fl2
val compare : filename -> filename -> int
compare fl1 fl2
Give an order between the two filename. The
classification is done by sub directory relation, fl1
< fl2
iff fl1
is
a subdirectory of fl2
, and lexicographical order of each part of the
reduce filename when fl1
and fl2
has no hierarchical relationval current_dir : filename
val parent_dir : filename
val make_filename : string list -> filename
val basename : filename -> filename
val dirname : filename -> filename
val concat : filename -> filename -> filename
val reduce : ?no_symlink:bool -> filename -> filename
no_symlink
flag is set, consider that the path doesn't contain symlink
and in this case ".." for Unix filename are also reduced.val make_absolute : filename -> filename -> filename
val make_relative : filename -> filename -> filename
val reparent : filename ->
filename -> filename -> filename
reparent fln_src fln_dst fln
Return the same filename as fln
but the root is no more fln_src
but fln_dst
. It replaces the
fln_src
prefix by fln_dst
.val identity : filename -> filename
val is_valid : filename -> bool
val is_relative : filename -> bool
val is_current : filename -> bool
val is_parent : filename -> bool
val chop_extension : filename -> filename
val get_extension : filename -> extension
val check_extension : filename -> extension -> bool
val add_extension : filename -> extension -> filename
val replace_extension : filename -> extension -> filename
string_of_path
and path_of_string
allow to
convert this kind of list by using the good separator between filename.val string_of_path : filename list -> string
val path_of_string : string -> filename list
module type PATH_SPECIFICATION =sig
..end
module type PATH_STRING_SPECIFICATION =sig
..end
FilePath.DefaultPath
always match the
current OS.module DefaultPath:PATH_STRING_SPECIFICATION
module UnixPath:PATH_STRING_SPECIFICATION
module MacOSPath:PATH_STRING_SPECIFICATION
module Win32Path:PATH_STRING_SPECIFICATION
module CygwinPath:PATH_STRING_SPECIFICATION