Module type Runtime.RUNTIME

type 'a t
val bind : 'a t -> ('a -> 'b t) -> 'b t
val return : 'a -> 'a t
val get_time : unit -> float t

get_time () should returns a float like Unix.gettimeofday ().

val file_exists : Filepath.t -> bool t

file_exists path should returns true if path exists (as a file or a directory), false otherwise.

val target_exists : Filepath.t -> bool t

Same of file_exists but acting on the target.

val is_directory : Filepath.t -> bool t

is_directory path should returns true if path is an existing file and if the file is a directory, false otherwise.

val get_modification_time : Filepath.t -> int Try.t t

get_modification_time path should returns a Try.t containing the modification time (as an integer) of the given file. The function may fail.

val target_modification_time : Filepath.t -> int Try.t t

Same of get_modification_time but acting on the target.

val read_file : Filepath.t -> string Try.t t

read_file path should returns a Try.t containing the content (as a string) of the given file. The function may fail.

val content_changes : Filepath.t -> string -> bool Try.t t

content_changes filepath new_content check if the content of the file has been changed.

val write_file : Filepath.t -> string -> unit Try.t t

write_file path content should write (create or overwrite) content into the given path. The function may fail.

val read_dir : Filepath.t -> Filepath.t list t

read_dir path should returns a list of children. The function is pretty optimistic if the directory does not exist, or for any other possible reason the function should fail, it will return an empty list.

val create_dir : ?file_perm:int -> Filepath.t -> unit t

create_dir path is an optimistic version of mkdir -p, the function extract the directory of a file and create it if it does not exists without any failure.

val log : Log.level -> string -> unit t

log level message justs dump a message on stdout.

val command : string -> int t

command cmd performs a shell commands and returns the exit code.