Legend:
Library
Module
Module type
Parameter
Class
Class type
Accessing paths on a file-system.
A _ Path.t represents a particular location in some filesystem. It is a pair of a base directory and a relative path from there.
Eio.Stdenv.cwd provides access to the current working directory. For example:
let ( / ) = Eio.Path.( / )
let run dir =
Eio.Path.save ~create:(`Exclusive 0o600)
(dir / "output.txt") "the data"
let () =
Eio_main.run @@ fun env ->
run (Eio.Stdenv.cwd env)
It is normally not permitted to access anything above the base directory, even by following a symlink. The exception is Stdenv.fs, which provides access to the whole file-system:
with_open_in is like open_in, but calls fn flow with the new flow and closes it automatically when fn returns (if it hasn't already been closed by then).
with_open_out is like open_out, but calls fn flow with the new flow and closes it automatically when fn returns (if it hasn't already been closed by then).
with_open_dir is like open_dir, but calls fn dir with the new directory and closes it automatically when fn returns (if it hasn't already been closed by then).