Module Data_dir

Data directory management.

@path handling

val is_at_path : B0_std.Fpath.t -> bool

is_at_path p is true iff p starts with @.

val atify_path : B0_std.Fpath.t -> B0_std.Fpath.t

atify_path p prefixes p with @. p is assumed to be relative.

val maybe_atify_path : data_dir:B0_std.Fpath.t -> B0_std.Fpath.t -> B0_std.Fpath.t

maybe_atify_path ~data_dir p atifies p iff data_dir is a strict prefix of p.

val resolve_path : data_dir:B0_std.Fpath.t -> B0_std.Fpath.t -> B0_std.Fpath.t

resolve_path ~data_dir ~default p is p if p does not start with an valid @. Otherwise resolves it replaces @ by the data_dir path. The path may not exist.

Data directory files

val files : data_dir:B0_std.Fpath.t -> rel:bool -> (B0_std.Fpath.t list, string) Stdlib.result

files ~data_dir is the list of files in the data dir. If rel is true the files are relative to data_dir and prefixed with @.

Section

Sections are dedicated sub-directories of the data directtory.

type section =
  1. | Boot
  2. | Images
  3. | Plans
  4. | Winvos

The type for data directory sections, i.e. subdirectories.

val section_to_string : section -> string

section_to_string s is a segment name for the section.

val section_dir : data_dir:B0_std.Fpath.t -> rel:bool -> section -> B0_std.Fpath.t

section_dir ~data_dir section is the directory to section for data_dir, if rel is true the directory is relative to data_dir and prefixed with @.

val section_files : data_dir:B0_std.Fpath.t -> section -> rel:bool -> (B0_std.Fpath.t list, string) Stdlib.result

section_files is like files but only lists the files in the given section.