Module Mfat_bos.MakeSource

Parameters

module Blk : Mfat.BLOCK

Signature

Sourcetype blk = Blk.t
Sourceval format : blk -> total_sectors:int -> unit
Sourceval create : blk -> (blk Mfat.t, [> `Msg of string ]) result

Path operations

Sourceval exists : blk Mfat.t -> Fpath.t -> (bool, 'err) result

exists t p is true if p exists for the file system and false otherwise.

Sourceval must_exist : blk Mfat.t -> Fpath.t -> (Fpath.t, [> `Msg of string ]) result

must_exist p is Ok p if p exists for the file system and an error otherwise.

Sourceval delete : blk Mfat.t -> ?must_exist:bool -> ?recurse:bool -> Fpath.t -> (unit, [> `Msg of string ]) result

delete ~must_exist ~recurse p deletes the path p. If must_exist is true (defaults to false) an error is returned if p doesn't exist. If recurse is true (defaults to false) and p is a directory, no error occurs if the directory is non-empty: its contents is recursively deleted first.

Sourceval stat : blk Mfat.t -> Fpath.t -> (Mfat.entry, [> `Msg of string ]) result

stat p is p's file information.

Sourcetype 'a error = Fpath.t -> ('a, [ `Msg of string ]) result -> (unit, [ `Msg of string ]) result

The type for managing fold errors.

Sourcetype elements = [
  1. | `Any
  2. | `Files
  3. | `Dirs
  4. | `Sat of blk Mfat.t -> Fpath.t -> (bool, [ `Msg of string ]) result
]

The type for specifying elements being folded over.

Sourcetype traverse = [
  1. | `Any
  2. | `None
  3. | `Sat of blk Mfat.t -> Fpath.t -> (bool, [ `Msg of string ]) result
]

The type for controlling directory traversals.

Sourceval fold : ?err:'a error -> ?dotfiles:bool -> ?elements:elements -> ?traverse:traverse -> blk Mfat.t -> (Fpath.t -> 'acc -> 'acc) -> 'acc -> Fpath.t list -> ('acc, [ `Msg of string ]) result

fold err dotfiles elements traverse fn acc paths folds over the list of paths paths traversing directories according to traverse (defaults to `Any) and selecting elements to fold over according to elements (defaults to `Any).

If dotfiles is false (default) both elements and directories to traverse that start with a . are skipped. . and .. entries are always skipped.

err manages fold errors (see error).

Matching path patterns against the file system

Sourceval matches : blk Mfat.t -> ?dotfiles:bool -> Fpath.t -> (Fpath.t list, [> `Msg of string ]) result

matches t ~dotfiles pat is the list of paths in the file system that match the path pattern pat. If dotfiles is false (default) elements that start with a . are skipped.

Sourceval query : blk Mfat.t -> ?dotfiles:bool -> ?init:Pat.defs -> Fpath.t -> ((Fpath.t * Pat.defs) list, [> `Msg of string ]) result

query t ~dotfiles ~init pat is like matches except each matching path is returned with an environment mapping pattern variables to their matched part.

File operations

Sourcemodule File : sig ... end

Directory operations

Sourcemodule Dir : sig ... end