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 -> boolis_subdir fl1 fl2 Is fl2 a sub directory of fl1val is_updir : filename -> filename -> boolis_updir fl1 fl2 Is fl1 a sub directory of fl2val compare : filename -> filename -> intcompare 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 : filenameval parent_dir : filenameval make_filename : string list -> filenameval basename : filename -> filenameval dirname : filename -> filenameval concat : filename -> filename -> filenameval reduce : ?no_symlink:bool -> filename -> filenameno_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 -> filenameval make_relative : filename -> filename -> filenameval reparent : filename ->
filename -> filename -> filenamereparent 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 -> filenameval is_valid : filename -> boolval is_relative : filename -> boolval is_current : filename -> boolval is_parent : filename -> boolval chop_extension : filename -> filenameval get_extension : filename -> extensionval check_extension : filename -> extension -> boolval add_extension : filename -> extension -> filenameval replace_extension : filename -> extension -> filenamestring_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 -> stringval path_of_string : string -> filename listmodule 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