Page
Library
Module
Module type
Parameter
Class
Class type
Source
Tree.SimpleA truly very naive implementation of a file system where the contents of files are strings and their metadata only associates modification dates.
The API throws Simple_error exceptions to mimic Unix behaviour.
The API relies on exceptions to describe failures. Each function that may fail throws the Dummy_tree exception.
exception Simple_error of errorval error_to_string : error -> stringRender an error as an Unix-like error message.
val const_clock : float -> 'a clockconst_clock f creates a constant clock, always returning f.
mount ?clock ~scope children creates a tree using make.
file ?clock ~name content creates a file. The clock is parametrized by the couple of name, content.
dir ?clock ~name children creates a directory. The clock is parametrized by the name of the directory.
mtime ~path fs returns the modification time of the given item located at the given path.
is_empty_dir ~path fs returns true if the directory located at path for the given fs is an empty directory.
mkdir ?recursive ?clock ~path creates the directory referenced by the given path with behaviour similar to the Unix command mkdir (the recursive flag is for mkdir -p, default is false).
rm ~path fs remove the item by a given path (like Tree.rm but raising exception).
rm_file fs path remove the file by a given path (like Tree.rm_file but raising exception).
rm_dir fs path remove the directory by a given path (like Tree.rm_dir but raising exception).
val write_file :
?overwrite:bool ->
?clock:((string * content) -> time) ->
path:Path.t ->
string ->
t ->
twrite_file ?overwrite ?clock ~path content fs creates (or overwrites, depending on the overwrite flag, default false) the file path with content content on the given fs.
read_file ~path fs Reads the contents of the file referenced by its path for a given fs.
val read_dir : path:Path.t -> t -> item Path.Map.t