package file_path
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=4c44185450fffa919bf900db1b54f2788f6831048997df390ef3bcf58395c41c
doc/file_path/File_path/Relative/index.html
Module File_path.Relative
Source
Relative paths are a subtype of Path.t
and therefore also of string
.
type comparator_witness = Types.Relative.comparator_witness
include Types.Type
with type t := t
and type comparator_witness := comparator_witness
include Ppx_compare_lib.Equal.S with type t := t
include Ppx_compare_lib.Comparable.S with type t := t
include Ppx_hash_lib.Hashable.S with type t := t
include Core.Comparator.S
with type t := t
with type comparator_witness := comparator_witness
Path types have straightforward to_string
and sexp_of_t
behavior. of_string
and t_of_sexp
raise on invalid input (e.g. containing null characters), and guarantee canonical output (e.g. no redundant slashes).
to_string
is the identity function. of_string
returns its input when the input is a valid string in canonical form.
include Core.Identifiable.S
with type t := t
and type comparator_witness := comparator_witness
include Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
This function only needs implementation if t
exposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the variant t
afterwards.
include Ppx_hash_lib.Hashable.S with type t := t
include Sexplib0.Sexpable.S with type t := t
include Ppx_compare_lib.Comparable.S with type t := t
include Ppx_hash_lib.Hashable.S with type t := t
include Base.Pretty_printer.S with type t := t
val pp : Base__.Formatter.t -> t -> unit
include Core.Comparable.S_binable
with type t := t
with type comparator_witness := comparator_witness
include Base.Comparable.S
with type t := t
with type comparator_witness := comparator_witness
compare t1 t2
returns 0 if t1
is equal to t2
, a negative integer if t1
is less than t2
, and a positive integer if t1
is greater than t2
.
ascending
is identical to compare
. descending x y = ascending y x
. These are intended to be mnemonic when used like List.sort ~compare:ascending
and List.sort ~cmp:descending
, since they cause the list to be sorted in ascending or descending order, respectively.
clamp_exn t ~min ~max
returns t'
, the closest value to t
such that between t' ~low:min ~high:max
is true.
Raises if not (min <= max)
.
val comparator : (t, comparator_witness) Base__.Comparator.comparator
module Map :
Core.Map.S_binable
with type Key.t = t
with type Key.comparator_witness = comparator_witness
module Set :
Core.Set.S_binable
with type Elt.t = t
with type Elt.comparator_witness = comparator_witness
Command-line argument. Supports tab-completion.
Returns the final part of the given path.
Returns all parts of the given path but the final one, or None
if the path has only one part.
Returns all parts of the given path but the final one, or raises if the path has only one part.
Returns all parts of the given path but the final one, or returns an error if the path has only one part.
Returns all parts of the given path but the final one, or dot
if the path has only one part.
Returns the first part of a multiple-part path, or None
if given a single-part path.
Returns the first part of a multiple-part path, or raises if given a single-part path.
Returns the first part of a multiple-part path, or returns an error if given a single-part path.
Returns the first part of a multiple-part path, or Part.dot
if given a single-part path.
Returns all but the first part of a multiple-part relative path, or None
if given a single-part path.
Returns all but the first part of a multiple-part relative path, or raises if given a single-part path.
Returns all but the first part of a multiple-part relative path, or returns an error if given a single-part path.
Returns all but the first part of a multiple-part relative path, or returns the path unchanged if given a single-part path.
Like Option.both (top_dir t) (all_but_top_dir t)
. Allocates Some
at most once.
Adds the given string as a suffix of the path's basename. Raises if the string contains characters that are illegal for a path part.
Adds a part to the beginning of the path.
Adds a part to the end of the path.
Reports if the parts of prefix
are a non-strict prefix of the parts of the other argument.
Reports if the parts of suffix
are a non-strict suffix of the parts of the other argument.
Returns all parts of the given path after prefix
, or None
if prefix
is not a prefix of the path's parts. If the path equals prefix
, returns dot
.
Returns all parts of the given path after prefix
, or raises if prefix
is not a prefix of the path's parts. If the path equals prefix
, returns dot
.
Returns all parts of the given path after prefix
, or returns an error if prefix
is not a prefix of the path's parts. If the path equals prefix
, returns dot
.
Returns all parts of the given path after prefix
, or returns the path unchanged if prefix
is not a prefix of the path's parts. If the path equals prefix
, returns dot
.
Returns all parts of the given path before suffix
, or None
if suffix
is not a suffix of the path's parts. If the path equals suffix
, returns dot
.
Returns all parts of the given path before suffix
, or raises if suffix
is not a suffix of the path's parts. If the path equals suffix
, returns dot
.
Returns all parts of the given path before suffix
, or returns an error if suffix
is not a suffix of the path's parts. If the path equals suffix
, returns dot
.
Returns all parts of the given path before suffix
, or returns the path unchanged if suffix
is not a suffix of the path's parts. If the path equals suffix
, returns dot
.
Removes .
parts from the given path. Returns .
if the given path consists only of one or more .
parts.
Removes .
parts from the given path. Cancels out ..
parts with preceding parts (that are neither .
nor ..
). Does not check the file system; in the presence of symlinks, the resulting path may not be equivalent. Returns .
if all parts are canceled out.
Returns a path consisting of the single given part.
Produces the parts of the path.
Produces the parts of the path.
Returns a relative path consisting of the given one or more parts, or None
if the list of parts is empty.
Returns a relative path consisting of the given one or more parts, or raises if the list of parts is empty.
Returns a relative path consisting of the given one or more parts, or returns an error if the list of parts is empty.
Returns a relative path consisting of the given one or more parts, or dot
if the list of parts is empty.
Returns a relative path consisting of the given one or more parts.