module Path:sig
..end
Path
provides three types for handling paths. Values of type
Assemblage.Path.t
are for paths that are either relative or absolute while
those of type Assemblage.Path.rel
and Assemblage.Path.abs
specialize to either
case.
Relative paths and absolute path each have corresponding modules
Assemblage.Path.Rel
and Assemblage.Path.Abs
with specialized functions. Conversion
between the three type of paths are explicit.
FIXME. We need to properly handle Filename.current_dir_name
and
Filename.parent_dir_name
in path segments.
typefilename =
string
type
rel
type
abs
type
t
val root : t
root
is the root absolute path (empty list of segments).val empty : t
empty
is the empty relative path (empty list of segments).val dash : t
dash
is the "-"
relative path.val add : t -> string -> t
add p seg
concatenates seg
at the end of p
. For any p
,
add p "" = p
.val concat : t -> rel -> t
concat p p'
concatenates p'
at the end of p
.val (/) : t -> string -> t
p / c
is add p c
. Left associative.val (//) : t -> rel -> t
p // p'
is concat p p'
. Left associative.val file : filename -> t
file name
is add empty f
.val base : string -> t
base name
is add empty f
.val basename : t -> string
basename p
is the basename of p
. If p
has no segments the
empty string is returned.val dirname : t -> t
dirname p
is the dirname of p
. If p
has no segments p
is returned.val rem_prefix : t -> t -> rel option
rem_prefix pre p
is p
with the literal prefix pre
removed. None
if pre
is not a prefix of p
.val find_prefix : t -> t -> t option
find_prefix p p'
is a common prefix for p
and p'
. There is
always a common prefix between path of the same kind (either Assemblage.Path.root
or Assemblage.Path.empty
and None
is only returned if p
and p'
are of
different kind.val is_root : t -> bool
val is_empty : t -> bool
val is_dash : t -> bool
val is_rel : t -> bool
is_rel p
is true
iff p
is a relative path.val is_abs : t -> bool
is_abs p
is true
iff p
is an absolute path.val is_prefix : t -> t -> bool
is_prefix p p'
is true
if p
is a literal prefix of p'
.val equal : t -> t -> bool
equal p p'
is p = p'
.val compare : t -> t -> int
compare p p'
is Pervasives.compare p p'
.val to_rel : t -> rel option
to_rel p
is Some r
if p
is a relative path.val of_rel : rel -> t
of_rel r
is r
as a path.val to_abs : t -> abs option
to_abs p
is Some a
if p
is an absolute path.val of_abs : abs -> t
of_abs a
is a
as a path.val to_segs : t -> [ `Abs of string list | `Rel of string list ]
to_segs p
is p
's segments.val of_segs : [ `Abs of string list | `Rel of string list ] -> t
of_segs segs
is a path from segs
segments.val to_string : t -> string
to_string p
is the path p
as a string according to
the driver's platform convention with Filename.dir_sep
.val of_string : string -> t
of_string s
is the string s
as a path. s
is splitted
according to the driver's platform convention with Filename.dir_sep
.val quote : t -> string
quote p
is the path p
as a string, quoted according
to the driver's platform conventions with Filename.quote
.val pp : Format.formatter -> t -> unit
typeext =
[ `A
| `Byte
| `C
| `Cma
| `Cmi
| `Cmo
| `Cmt
| `Cmti
| `Cmx
| `Cmxa
| `Cmxs
| `Css
| `Dll
| `Exe
| `Ext of string
| `Gif
| `H
| `Html
| `Img
| `Install
| `Jpeg
| `Js
| `Json
| `Lib
| `Md
| `Ml
| `Ml_dep
| `Ml_pp
| `Mli
| `Mli_dep
| `Mli_pp
| `Native
| `O
| `Opt
| `Png
| `Sh
| `So
| `Tar
| `Tbz
| `Xml
| `Zip ]
val ext_to_string : ext -> string
ext_to_string ext
is ext
as a string (without separator).val ext_of_string : string -> ext
ext_of_string ext
is ext
as a file extension (ext
without
separator).val pp_ext : Format.formatter -> ext -> unit
val ext : t -> ext option
ext p
is p
's last segment file extension (if any).val get_ext : t -> ext
get_ext p
is p
's last segment file extension.Invalid_argument
if p
's last segment has no file extension.val add_ext : t -> ext -> t
add_ext p ext
is p
with ext
concatenated to p
's last segment.val rem_ext : t -> t
rem_ext p
is p
with ext
removed from p
's last segment
(if it has an extension).val change_ext : t -> ext -> t
change_ext p e
is add_ext (rem_ext p)
.val (+) : t -> ext -> t
p + ext
is add_ext p e
. Left associative.val has_ext : ext -> t -> bool
has_ext p ext
is true
iff p
's last segment has file extension
ext
.val ext_matches : ext list -> t -> bool
ext_matches exts p
is true
iff p
's last segment has a file
extension in exts
.module Rel:sig
..end
module Abs:sig
..end
module Set:sig
..end
module Map:sig
..end