@@ -192,13 +192,13 @@ let read_cmi ic =
192
192
193
193
#endif
194
194
195
- let classify dir files libraries =
196
- let libraries = StringSet . elements libraries in
195
+ let classify files libraries =
196
+ let libraries = Fpath.Set . elements libraries in
197
197
198
198
let archives =
199
199
List. map
200
- (fun lname ->
201
- let path ext = Fpath. (v dir / lname |> set_ext ext |> to_string) in
200
+ (fun lpath ->
201
+ let path ext = Fpath. (set_ext ext lpath |> to_string) in
202
202
let paths = [ path " .cma" ; path " .cmxa" ] in
203
203
List. fold_left
204
204
(fun cur path ->
@@ -210,20 +210,20 @@ let classify dir files libraries =
210
210
| Error (`Msg m ) ->
211
211
Format. eprintf " Error reading library: %s\n %!" m;
212
212
cur)
213
- (Archive. empty lname ) paths)
213
+ (Archive. empty ( Fpath. basename lpath) ) paths)
214
214
libraries
215
215
in
216
216
217
- let cmis = List. filter (fun f -> Fpath. ( has_ext " .cmi" (v f)) ) files in
217
+ let cmis = List. filter (Fpath. has_ext " .cmi" ) files in
218
218
let cmi_names =
219
219
List. map
220
- (fun f -> Fpath. (rem_ext (v f) |> basename |> Astring.String.Ascii. capitalize))
220
+ (fun f -> Fpath. (rem_ext f |> basename |> Astring.String.Ascii. capitalize))
221
221
cmis
222
222
in
223
223
224
224
let _impls, intfs =
225
225
let check f ext =
226
- Sys. file_exists Fpath. (v dir / f |> set_ext ext |> to_string)
226
+ Sys. file_exists Fpath. (set_ext ext f |> to_string)
227
227
in
228
228
List. partition (fun f -> check f " .cmo" || check f " cmx" ) cmis
229
229
in
@@ -232,9 +232,9 @@ let classify dir files libraries =
232
232
List. map
233
233
(fun f ->
234
234
let modname =
235
- Filename. chop_suffix f " .cmi" |> Astring.String.Ascii. capitalize
235
+ Filename. chop_suffix ( Fpath. basename f) " .cmi" |> Astring.String.Ascii. capitalize
236
236
in
237
- (modname, Cmi. get_deps Fpath. (v dir / f |> to_string)))
237
+ (modname, Cmi. get_deps Fpath. (f |> to_string)))
238
238
intfs
239
239
in
240
240
@@ -398,18 +398,19 @@ let classify dir files libraries =
398
398
399
399
()
400
400
401
- let classify dir =
402
- let files = Sys. readdir dir |> Array. to_list in
401
+ let classify dirs =
402
+ let files =
403
+ List. map (fun dir ->
404
+ Sys. readdir dir |> Array. to_list |> List. map (fun p -> Fpath. (v dir / p))) dirs |> List. flatten in
403
405
404
406
let libraries =
405
407
List. fold_left
406
- (fun acc f ->
407
- let p = Fpath. v f in
408
+ (fun acc p ->
408
409
if Fpath. has_ext " .cma" p || Fpath. has_ext " .cmxa" p then
409
- StringSet. add Fpath. (rem_ext p |> to_string ) acc
410
+ Fpath.Set. add Fpath. (rem_ext p) acc
410
411
else acc)
411
- StringSet . empty files
412
+ Fpath.Set . empty files
412
413
in
413
414
414
- if StringSet . cardinal libraries = 0 then Ok ()
415
- else Ok (classify dir files libraries)
415
+ if Fpath.Set . cardinal libraries = 0 then Ok ()
416
+ else Ok (classify files libraries)
0 commit comments