package ocp-ocamlres

  1. Overview
  2. Docs

Module OCamlRes.ResSource

Resource store creation and access.

Sourcetype 'a node =
  1. | Dir of string * 'a node list
  2. | File of string * 'a
  3. | Error of string

A resource: a directory of named sub-resources, a file, or an error token (useful to write more resilient treatments).

Sourcetype 'a root = 'a node list

A ressource store (a list of toplevel resources)

Sourceval merge : 'a root -> 'a root -> 'a root

Merges two resource stores

Sourceval find : Path.t -> 'a root -> 'a

Find a resource from its path or raise Not_found.

Sourceval find_dir : Path.t -> 'a root -> 'a root

Find a directory (as a root) from its path or raise Not_found.

Sourceval add : Path.t -> 'a -> 'a root -> 'a root

Build a new root with an added file.

Sourceval map : ('a -> 'b) -> 'a root -> 'b root

Transforms the data of a tee, potentially changing their type.

Sourceval add_prefix : Path.dirs -> 'a node -> 'a node

Add a prefix directory to a node.

OCaml

Innovation. Community. Security.