Skip to content

Commit

Permalink
fix generator to use argv to simplify the jbuild rules
Browse files Browse the repository at this point in the history
rename more-mime.types to x-mime.types for clarity
  • Loading branch information
avsm committed Jun 20, 2017
1 parent d9816a4 commit 6423c51
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions generator/generate_mime_types.ml
Expand Up @@ -35,16 +35,13 @@ let file_iter fn c =
let _ =
Arg.parse options (fun s -> files := s :: !files)
(Printf.sprintf "Usage: %s [options]\nwhere options are:" Sys.argv.(0));
let fin =
match List.rev !files with
[] -> stdin
| file :: _ -> open_in file
in
let fun_name = if !extensions then "map_extension" else "map_file" in
let dup = Hashtbl.create 101 in
printf "(* This function is autogenerated by %s *)\n" (Sys.argv.(0));
printf "(* This function is autogenerated by: %s *)\n" (String.concat " " (Array.to_list Sys.argv));
printf "let %s = function\n" fun_name;
file_iter (fun l ->
List.iter (fun fname ->
let fin = open_in fname in
file_iter (fun l ->
match split (regexp "\t+") l with
| [] -> ()
| [_] -> ()
Expand All @@ -58,4 +55,6 @@ let _ =
) (split (regexp " +") exts)
| _ -> ()
) fin;
close_in fin
) (List.rev !files);
printf " | _ -> \"application/octet-stream\"\n%!"
4 changes: 2 additions & 2 deletions src/jbuild
Expand Up @@ -8,5 +8,5 @@
((targets (mime_types.ml))
(deps (../generator/generate_mime_types.exe))
(action (with-stdout-to ${@}
(progn (run ${<} ../../../mime.types)
(run ${<} ../../../more-mime.types --files))))))
(progn (run ${<} ../../../mime.types ../../../x-mime.types)
(run ${<} ../../../files.types --files))))))
File renamed without changes.

0 comments on commit 6423c51

Please sign in to comment.