package ocp-ocamlres

  1. Overview
  2. Docs

Paths inside resource stores.

type t = dirs * name option

A path is a list of directory names and optionally a file name which is itself decomposed into a basename and an optional extension.

and dirs = string list
and name = string * ext option
and ext = string
val split_ext : string -> string * ext option

Splits the part before and after the first dot after the last slash (if any).

val split_base : string -> string * string option

Splits the part before and after the last slash (if any).

val split_dirs : string -> dirs

Splits a string using slashes as separator.

val shorten : t -> t

Applies ".."s and drops prefix ".."s and "."s.

val name_of_string : string -> name

Alias for split_ext.

val string_of_name : name -> string

Inverse of split_ext.

val of_string : string -> t

Turns a Unix-like path string into a t.

val to_string : t -> string

Turns a t into a Unix-like formatted path string.

OCaml

Innovation. Community. Security.