Module Platform.FS

High-level filesystem operations

val read_text_file_in_path : concat:('a -> string -> string) -> read_text_file:(string -> 'b) -> stat_file:(string -> 'c option) -> search_path:'a list -> string -> (string * 'b) option

read_text_file_in_path ~concat ~read_text_file ~stat_file implements platform.read_text_file_in_path, naming candidates concat dir filename. A candidate that cannot be read is skipped if stat_file tells it does not exist.

val with_temp_dir : platform:TYPES.platform -> default_pattern_prefix:string -> ?given_temp_dir:string -> (temp_dir:string -> 'a) -> 'a

with_temp_dir ~platform ?given_temp_dir f creates a temporary directory temp_dir and executes f ~temp_dir if given_temp_dir is None, or executes f ~temp_dir:dir if given_temp_dir is Some dir. temp_dir is removed upon termination of f in the former case; otherwise, the directory is left in place.

default_pattern_prefix is used to forge a name for the directory created, if any.