# Module Topkg.OS.Dir

    module Dir: sig .. end

Directory operations.

## Existence and contents

    val exists : Topkg.fpath -> bool Topkg.result

`exists dir` is `true` if directory `dir` exists in the file system. Symbolic links are followed.

    val must_exist : Topkg.fpath -> Topkg.fpath Topkg.result

`must_exist dir` is `dir` if `file` is a regular file in the file system and an error otherwise. Symbolic links are followed.

    val contents : ?dotfiles:bool -> ?rel:bool -> Topkg.fpath -> Topkg.fpath list Topkg.result

`contents ~dotfiles ~rel dir` is the list of directories and filse in `dir`. If `rel` is `true` (defaults to `false`) the resulting paths are relative to `dir`, otherwise they have `dir` prepended. If `dotfiles` is `false` (default) elements that start with a `.` are omitted.

## Current working directory

    val current : unit -> Topkg.fpath Topkg.result

`current ()` is the current working directory.

    val set_current : Topkg.fpath -> unit Topkg.result

`set_current dir` sets the current working directory to `dir`.

    val with_current : Topkg.fpath -> ('a -> 'b) -> 'a -> 'b Topkg.result

`with_current dir f v` is `f v` with the current working directory bound to `dir`. After the function returns the current working directory is back to its initial value.