(* Reload the jobs file(s). *)
and reload_files () =
- (* Get dir/*.cmo *)
+ (* Get dir/*.cmo (bytecode) or dir/*.cmxs (native code) *)
+ let suffix = if not Dynlink.is_native then ".cmo" else ".cmxs" in
let dir = !jobsdir in
let files = Array.to_list (Sys.readdir dir) in
- let files = List.filter (
- fun file ->
- let n = String.length file in
- n >= 5 && String.sub file (n-4) 4 = ".cmo"
- ) files in
+ let files = List.filter (fun file -> string_endswith file suffix) files in
let files = List.map (fun file -> dir // file) files in
let files = List.sort compare files in