- | hds ->
- let roots_and_targets =
- List.map (fun (root, buri, file, target) -> root,target)
- (List.map (Librarian.baseuri_of_script ~include_paths:[]) hds) in
- let roots,targets = List.split roots_and_targets in
- let root = List.hd roots in
- if (List.exists (fun root' -> root' <> root) roots) then
- (prerr_endline "Only targets in the same root can be specified.";exit 1);
- targets, root
+ | _ ->
+ let map targets file =
+ if HExtlib.is_dir file then
+ let files = HExtlib.find ~test:(fun path -> Filename.check_suffix path ".ma") file in
+ files @ targets
+ else file :: targets
+ in
+ List.fold_left map [] (List.rev targets)