package devkit

  1. Overview
  2. Docs
Development kit - general purpose library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

1.20261006.tar.gz
md5=a39dbbce04bd5562a9b4443daf39c582
sha512=b10104b61384b2151521b785e7f3c3250134c75eae09b42cad69bc4a22a9a5e429beb891ee87cedf376c23d9c40f09d3f71c3fd48aa35df490c0f69dc17f3242

doc/devkit.core/Devkit_core/Files/index.html

Module Devkit_core.FilesSource

File system

Sourceval enum_dir : Unix.dir_handle -> string Enum.t
Sourceval with_readdir : string -> (Unix.dir_handle -> 'a) -> 'a
Sourceval iter_names : string -> (Unix.file_descr -> string -> string -> unit) -> unit

f fd path rel gets invoked for each file under dirname where fd is a read-only Unix.file_descr, path is full path and rel - path relative to dirname

Sourceval iter_names_q : string -> (string -> string -> unit) -> unit

iter_names_q dirname (fun [path] [rel] -> ...)

Sourceval iter_files : string -> (string -> in_channel -> unit) -> unit

iter_files dirname (fun [path] [ic] -> ...)

Sourceval open_out_append_bin : string -> out_channel
Sourceval open_out_append_text : string -> out_channel
Sourceval mkdir_p : ?perm:Unix.file_perm -> string -> unit

mkdir_p ?perm path creates directory path and all missing parent directories. Similar to mkdir -p. Raises Failure if path exists but is not a directory. Default perm is 0o755.

Sourceval save_as : string -> ?mode:Unix.file_perm -> (out_channel -> unit) -> unit

save_as filename ?mode f is similar to Control.with_open_file_bin for regular files, except that writing is done to a temporary file that will be renamed to filename after f has succesfully terminated. Therefore this guarantee that either filename will not be modified or will contain whatever f was writing to it as a side-effect.

There is no such special treatment for special files (Unix.stat kind not S_REG, e.g. devices, pipes, etc), instead they are written to directly. Symlinks are followed (not overwritten in place). Throws Unix.Unix_error on broken symlinks.

FIXME windows