Module Core_kernel.Filename
type t= Core_kernel__.Import.string
include Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
val bin_size_t : t Bin_prot.Size.sizerval bin_write_t : t Bin_prot.Write.writerval bin_read_t : t Bin_prot.Read.readerval __bin_read_t__ : (int -> t) Bin_prot.Read.readerThis function only needs implementation if
texposed 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 varianttafterwards.
val bin_shape_t : Bin_prot.Shape.tval bin_writer_t : t Bin_prot.Type_class.writerval bin_reader_t : t Bin_prot.Type_class.readerval bin_t : t Bin_prot.Type_class.t
val compare : t -> t -> Core_kernel__.Import.intval hash_fold_t : Base.Hash.state -> t -> Base.Hash.stateval hash : t -> Base.Hash.hash_value
include Ppx_sexp_conv_lib.Sexpable.S with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> tval sexp_of_t : t -> Sexplib0.Sexp.t
include Comparable.S with type t := t with type comparator_witness = String.comparator_witness
include Core_kernel__.Comparable_intf.S_common
include Base.Comparable.S
include Base__.Comparable_intf.Polymorphic_compare
val ascending : t -> t -> intascendingis identical tocompare.descending x y = ascending y x. These are intended to be mnemonic when used likeList.sort ~compare:ascendingandList.sort ~cmp:descending, since they cause the list to be sorted in ascending or descending order, respectively.
val descending : t -> t -> intval between : t -> low:t -> high:t -> boolbetween t ~low ~highmeanslow <= t <= high
val clamp_exn : t -> min:t -> max:t -> tclamp_exn t ~min ~maxreturnst', the closest value totsuch thatbetween t' ~low:min ~high:maxis true.Raises if
not (min <= max).
val clamp : t -> min:t -> max:t -> t Base.Or_error.t
include Base.Comparator.S with type t := t
val comparator : (t, comparator_witness) Base.Comparator.comparator
include Base__.Comparable_intf.Validate with type t := t
val validate_lbound : min:t Base.Maybe_bound.t -> t Base.Validate.checkval validate_ubound : max:t Base.Maybe_bound.t -> t Base.Validate.checkval validate_bound : min:t Base.Maybe_bound.t -> max:t Base.Maybe_bound.t -> t Base.Validate.check
module Replace_polymorphic_compare : Core_kernel__.Comparable_intf.Polymorphic_compare with type t := tmodule Map : Map.S with type Key.t = t with type Key.comparator_witness = comparator_witnessmodule Set : Set.S with type Elt.t = t with type Elt.comparator_witness = comparator_witnessinclude Hashable.S with type t := t
include Hashable.Common
val compare : t -> t -> Core_kernel__.Import.intval hash_fold_t : Base.Hash.state -> t -> Base.Hash.stateval hash : t -> Base.Hash.hash_value
val hashable : t Hashtbl.Hashable.t
module Hash_set : Hash_set.S with type elt = tmodule Hash_queue : Hash_queue.S with type key = tval root : Core_kernel__.Import.stringThe path of the root.
Pathname resolution
val is_posix_pathname_component : Core_kernel__.Import.string -> Core_kernel__.Import.boolis_posix_pathname_component f- returns
true if
fis a valid path component on a POSIX compliant OSNote that this checks a path component, and not a full path.
http://www.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap03.html#tag_03_169
val temp_dir_name : Core_kernel__.Import.stringThe name of the temporary directory:
Under Unix, the value of the
TMPDIRenvironment variable, or "/tmp" if the variable is not set.Under Windows, the value of the
TEMPenvironment variable, or "." if the variable is not set.
val current_dir_name : Core_kernel__.Import.stringThe conventional name for the current directory (e.g.
.in Unix).
val parent_dir_name : Core_kernel__.Import.stringThe conventional name for the parent of the current directory (e.g.
..in Unix).
val dir_sep : Core_kernel__.Import.stringThe directory separator (e.g.
/in Unix).
val concat : Core_kernel__.Import.string -> Core_kernel__.Import.string -> Core_kernel__.Import.stringconcat p1 p2returns a path equivalent top1 ^ "/" ^ p2. In the resulting path p1 (resp. p2) has all its trailing (resp. leading) "." and "/" removed. eg: concat "a/." ".//b" => "a/b" concat "." "b" => "./b" concat "a" "." => "a/." concat "a" "/b" => "a/b"@throws Failure if
p1is empty.
val is_relative : Core_kernel__.Import.string -> Core_kernel__.Import.boolReturn
trueif the file name is relative to the current directory,falseif it is absolute (i.e. in Unix, starts with/).
val is_absolute : Core_kernel__.Import.string -> Core_kernel__.Import.boolval is_implicit : Core_kernel__.Import.string -> Core_kernel__.Import.boolReturn
trueif the file name is relative and does not start with an explicit reference to the current directory (./or../in Unix),falseif it starts with an explicit reference to the root directory or the current directory.
val check_suffix : Core_kernel__.Import.string -> Core_kernel__.Import.string -> Core_kernel__.Import.boolcheck_suffix name suffreturnstrueif the filenamenameends with the suffixsuff.
val chop_suffix : Core_kernel__.Import.string -> Core_kernel__.Import.string -> Core_kernel__.Import.stringchop_suffix name suffremoves the suffixsufffrom the filenamename. The behavior is undefined ifnamedoes not end with the suffixsuff.
val chop_extension : Core_kernel__.Import.string -> Core_kernel__.Import.stringReturn the given file name without its extension. The extension is the shortest suffix starting with a period and not including a directory separator,
.xyzfor instance.Raise
Invalid_argumentif the given name does not contain an extension.
val split_extension : Core_kernel__.Import.string -> Core_kernel__.Import.string * Core_kernel__.Import.string Core_kernel__.Import.optionsplit_extension fnreturn the portion of the filename before the extension and the (optional) extension. Example: split_extension "/foo/my_file" = ("/foo/my_file", None) split_extension "/foo/my_file.txt" = ("/foo/my_file", Some "txt") split_extension "/home/c.falls/my_file" = ("/home/c.falls/my_file", None)
val basename : Core_kernel__.Import.string -> Core_kernel__.Import.stringRespects the posix semantic.
Split a file name into directory name / base file name.
concat (dirname name) (basename name)returns a file name which is equivalent toname. Moreover, after setting the current directory todirname name(withSys.chdir), references tobasename name(which is a relative file name) designate the same file asnamebefore the call toSys.chdir.The result is not specified if the argument is not a valid file name (for example, under Unix if there is a NUL character in the string).
val dirname : Core_kernel__.Import.string -> Core_kernel__.Import.stringSee
Filename.basename.
val to_absolute_exn : Core_kernel__.Import.string -> relative_to:Core_kernel__.Import.string -> Core_kernel__.Import.stringReturns the absolute path by prepending
relative_toif the path is not already absolute.Using the result of
Core.Unix.getcwdasrelative_tois often a reasonable choice.Note that
to_absolute_exnmay return a non-canonical path (e.g. /foo/bar/../baz).Raises if
relative_tois a relative path.
val split : Core_kernel__.Import.string -> Core_kernel__.Import.string * Core_kernel__.Import.stringsplit filenamereturns (dirname filename, basename filename)
val parts : Core_kernel__.Import.string -> Core_kernel__.Import.string Core_kernel__.Import.listparts filenamereturns a list of path components in order. For instance: /tmp/foo/bar/baz ->"/"; "tmp"; "foo"; "bar"; "baz". The first component is always either "." for relative paths or "/" for absolute ones.
val of_parts : Core_kernel__.Import.string Core_kernel__.Import.list -> Core_kernel__.Import.stringof_parts partsjoins a list of path components into a path. It does roughly the opposite ofparts, but they fail to be precisely mutually inverse because of ambiguities like multiple consecutive slashes and . components.Raises an error if given an empty list.
val quote : Core_kernel__.Import.string -> Core_kernel__.Import.stringReturn a quoted version of a file name, suitable for use as one argument in a command line, escaping all meta-characters. Warning: under Windows, the output is only suitable for use with programs that follow the standard Windows quoting conventions.
See
Sys.quotefor an alternative implementation that is more human readable but less portable.
module Stable : sig ... end