@@ -46,6 +46,7 @@ val with_in : ?mode:int -> ?flags:open_flag list ->
46
46
(* * Open an input file with the given optional flag list, calls the function
47
47
on the input channel. When the function raises or returns, the
48
48
channel is closed.
49
+ @raise Sys_error in case of error (same as {!open_in} and {!close_in})
49
50
@param flags opening flags (default [[Open_text]]). [Open_rdonly] is used in any cases *)
50
51
51
52
val read_chunks : ?size : int -> in_channel -> string gen
@@ -77,12 +78,14 @@ val with_out : ?mode:int -> ?flags:open_flag list ->
77
78
string -> (out_channel -> 'a ) -> 'a
78
79
(* * Same as {!with_in} but for an output channel
79
80
@param flags opening flags (default [[Open_creat; Open_trunc; Open_text]]).
81
+ @raise Sys_error in case of error (same as {!open_out} and {!close_out})
80
82
[Open_wronly] is used in any cases *)
81
83
82
84
val with_out_a : ?mode : int -> ?flags : open_flag list ->
83
85
string -> (out_channel -> 'a ) -> 'a
84
86
(* * Similar to {!with_out} but with the [[Open_append; Open_creat; Open_wronly]]
85
- flags activated, to append to the file *)
87
+ flags activated, to append to the file.
88
+ @raise Sys_error in case of error (same as {!open_out} and {!close_out}) *)
86
89
87
90
val write_line : out_channel -> string -> unit
88
91
(* * Write the given string on the channel, followed by "\n" *)
@@ -102,6 +105,7 @@ val with_in_out : ?mode:int -> ?flags:open_flag list ->
102
105
string -> (in_channel -> out_channel -> 'a ) -> 'a
103
106
(* * Combines {!with_in} and {!with_out}.
104
107
@param flags opening flags (default [[Open_creat]])
108
+ @raise Sys_error in case of error
105
109
@since 0.12 *)
106
110
107
111
(* * {2 Misc for Generators} *)
@@ -144,7 +148,7 @@ module File : sig
144
148
(* * [remove_exn path] tries to remove the file at [path] from the
145
149
file system.
146
150
147
- {b Raises} [ Sys_error] if there is no file at [path].
151
+ @raise Sys_error if there is no file at [path] or access rights are wrong .
148
152
@since 0.8 *)
149
153
150
154
val remove : t -> unit or_error
@@ -158,11 +162,13 @@ module File : sig
158
162
val read_dir : ?recurse : bool -> t -> t gen
159
163
(* * [read_dir d] returns a sequence of files and directory contained
160
164
in the directory [d] (or an empty stream if [d] is not a directory)
165
+ @raise Sys_error in case of error (e.g. permission denied)
161
166
@param recurse if true (default [false]), sub-directories are also
162
167
explored *)
163
168
164
169
val read_exn : t -> string
165
170
(* * Read the content of the given file, or raises some exception
171
+ @raise Sys_error in case of error
166
172
@since 0.16 *)
167
173
168
174
val read : t -> string or_error
@@ -171,6 +177,7 @@ module File : sig
171
177
172
178
val append_exn : t -> string -> unit
173
179
(* * Append the given string into the given file, possibly raising
180
+ @raise Sys_error in case of error
174
181
@since 0.16 *)
175
182
176
183
val append : t -> string -> unit or_error
@@ -179,6 +186,7 @@ module File : sig
179
186
180
187
val write_exn : t -> string -> unit
181
188
(* * Write the given string into the given file, possibly raising
189
+ @raise Sys_error in case of error
182
190
@since 0.16 *)
183
191
184
192
val write : t -> string -> unit or_error
@@ -191,7 +199,8 @@ module File : sig
191
199
(* * Similar to {!read_dir} (with [recurse=true]), this function walks
192
200
a directory recursively and yields either files or directories.
193
201
Is a file anything that doesn't satisfy {!is_directory} (including
194
- symlinks, etc.) *)
202
+ symlinks, etc.)
203
+ @raise Sys_error in case of error (e.g. permission denied) during iteration *)
195
204
196
205
val show_walk_item : walk_item -> string
197
206
0 commit comments