Module Private.File
File IO.
val cut_ext : fpath -> string * string
cut_ext f
is(fst, snd)
the pair that results from cutting the basename off
at the rightmost'.'
(not included in the result) before the firstFilename
.dir_sep. If there is no such character, fst isf
andsnd
is""
.
val catch_sys_error : (unit -> ('a, string) Stdlib.result) -> ('a, string) Stdlib.result
catch_sys_error f
invokesf ()
and catches anySys_error
that may be raised and returns its messagee
asError e
.
val with_open_in : string -> (Stdlib.in_channel -> 'a) -> ('a, string) Stdlib.result
with_open_in file f
open a channel onfile
and gives it tof
. Ensures the channel is closed when the function returns and reports anySys_error
orEnd_of_file
as anError
.
val with_open_out : string -> (Stdlib.out_channel -> 'a) -> ('a, string) Stdlib.result
with_open_out file f
open a channel onfile
and gives it tof
. Ensures the channel is closed when the function returns and reports anySys_error
orEnd_of_file
as anError
.
val to_string : fpath -> (string, string) Stdlib.result
to_string file
reads filefile
to a string.
val of_string : fpath -> string -> (unit, string) Stdlib.result
of_string file s
writes filefile
withs
.
val exists : fpath -> (bool, string) Stdlib.result
exists file
istrue
ifffile
exists and is not a directory.
val delete : fpath -> (bool, string) Stdlib.result
delete file
deletes filefile
. The boolean indicates whether the file actually existed.