mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 11:45:31 -05:00
add CCIO.File.walk_l
This commit is contained in:
parent
801f059532
commit
6fadeb414e
2 changed files with 13 additions and 0 deletions
|
|
@ -320,6 +320,14 @@ module File = struct
|
||||||
)
|
)
|
||||||
*)
|
*)
|
||||||
|
|
||||||
|
let walk_l d =
|
||||||
|
let l = ref [] in
|
||||||
|
let g = walk d in
|
||||||
|
let rec aux () = match g() with
|
||||||
|
| None -> !l
|
||||||
|
| Some x -> l := x :: !l; aux ()
|
||||||
|
in aux ()
|
||||||
|
|
||||||
type walk_item = [`File | `Dir] * t
|
type walk_item = [`File | `Dir] * t
|
||||||
|
|
||||||
let read_dir ?(recurse=false) d =
|
let read_dir ?(recurse=false) d =
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,11 @@ module File : sig
|
||||||
symlinks, etc.)
|
symlinks, etc.)
|
||||||
@raise Sys_error in case of error (e.g. permission denied) during iteration *)
|
@raise Sys_error in case of error (e.g. permission denied) during iteration *)
|
||||||
|
|
||||||
|
val walk_l : t -> walk_item list
|
||||||
|
(** Same as {!walk} but returns a list (therefore it's eager and might
|
||||||
|
take some time on large directories)
|
||||||
|
@since NEXT_RELEASE *)
|
||||||
|
|
||||||
val show_walk_item : walk_item -> string
|
val show_walk_item : walk_item -> string
|
||||||
|
|
||||||
val with_temp :
|
val with_temp :
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue