Commit 0166d3c4 authored by Idir Lankri's avatar Idir Lankri

Sort by name files returned by Dir.files_with_ext

parent 7a410834
......@@ -8,15 +8,18 @@ value abs_files dir =
;
value basenames files = List.map Filename.basename files
;
value sort l = List.sort String.compare l
;
value subdirs dir =
let subdirs = List.filter Sys.is_directory (abs_files dir) in
List.sort String.compare (basenames subdirs)
subdirs |> basenames |> sort
;
value file_with_ext ext file =
not (Sys.is_directory file) && Filename.check_suffix file ("." ^ ext)
;
value files_with_ext ext dirname =
let files = List.filter (file_with_ext ext) (abs_files dirname) in
basenames files
files |> basenames |> sort
;
(*i end; i*)
(* Directory operations. *)
(* Directory operations *)
(*i module Dir : sig i*)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment