package metadb

  1. Overview
  2. Docs

This is a wrapper for the standard Sys library.

exception OSError of string
exception InternalError of string
exception NotADirectory of Path.root
val xopen : string -> unit

Try to open file with the system default program. This will try the unix command xdg-open followed by open upon failure. Raises OSError if both fail

val open_file : Path.root -> unit

Wrapper for xopen taking Path.root as input

val open_url : string -> unit

Wrapper for xopen for urls

val get_files : ?hidden:bool -> Path.root -> Path.root Stdlib.Seq.t

Get files recursively in a directory. Optional hidden argument is false if hidden files should be ignored, which is the default behavior. Raises NotADirectory if path is not a directory. Raises Sys.Sys_error if no such directory exists

val rmdir : Path.root -> unit

Recursively remove directory. Raises NotADirectory if path is not a directory. Raises Sys.Sys_error if no such directory exists

val remove : Path.root -> unit

Remove a file. Raises Sys.Sys_error if file is a directory or does not exist

val make_dirp : Path.root -> unit

Recursively create directories but ignore the leaf. For example, make_dirp "/path/to/file.txt" creates the directories "/path" and "/path/to" if they do not exist.

val make_dirp_leaf : Path.root -> unit

Same as make_dirp but creates a directory for the leaf

val move : Path.root -> Path.root -> unit

This is a wrapper for the fileutils library move command

val file_exists : Path.root -> bool

Returns true if file or directory exists

val empty_dir : Path.root -> bool

Returns true if directory is empty. Raises NotADirectory if path is not a directory and Sys.Sys_error if directory does not exist.

val getenv_opt : string -> string option

Returns value of environment variable