struct
(**
Reading directories*) |
(** Reads a given directory, thus select and convert names. @return the list of formatted names *) |
let readdir_into_list ?(namefilter:(string->bool)=(fun x -> true)) ?(nameconverter:(string->string)=(fun x->x)) (dir:string) =
try
let filelist = (Array.to_list (Sys.readdir dir)) in
let filter = (fun n -> (try (namefilter n) with _ -> false)) in
let selection = (List.filter filter filelist) in
(List.map nameconverter selection)
with _ -> []
;;
end