package spotlib

  1. Overview
  2. Docs
module Find : sig ... end
module CommandDeprecated : sig ... end

Command invocation

val timed : ('a -> 'b) -> 'a -> 'b * float
module Process_times : sig ... end
val mkdir : ?perm:Unix.file_perm -> ?recursive:bool -> string -> (unit, string * [> `Unix of Unix.error | `Already_exists of Unix.stats | `Not_a_directory of Unix.stats ]) result

Create a directory of the given name. Does nothing if the directory exists already.

Bug: No chmod if the directroy already exists.

val mkdtemp : string -> string

Like mkdtemp(3). It must take a template whose postfix is "XXXXXX". It creates a new directory name by replacing "XXXXXX" by random number then creates a directory of permission 0o700

val with_dtemp : string -> (string -> 'a) -> 'a

with_dtemp template f creates a temp directory dir using mkdtemp template then runs f dir. The temp directory dir is automatically removed (even if it is not empty) after f dir.

val with_chdir : ?at_failure:(exn -> 'a) -> string -> (unit -> 'a) -> 'a

with_chdir ?at_failure dir f may raises an exception when:

  • at_failure raises an exception when the first chdir failure is reported to it
  • f () raises an exception
  • chdir back to the original directory fails (reported by Exn.Finally)
val with_dir : string -> (Unix.dir_handle -> 'a) -> 'a

with_dir dir f runs f with the dir_handle against dir

val fold_dir : string -> 'a -> ('a -> string -> 'a) -> 'a

fold_dir dir init f runs f folding over the files under the directory dir, with the initial value init

val timed_message : string -> ('a -> 'b) -> 'a -> 'b

timed_message mes f returns a function as same as f but with printing computation times to stderr.

module Stdlib : sig ... end

values accessible simply via open Spotlib.Spot