fix quoting inside ocamlmktop (win32) (#771)
parent
9d4833d604
commit
7bc893a564
|
@ -16,7 +16,17 @@
|
|||
let _ =
|
||||
let args = Ccomp.quote_files (List.tl (Array.to_list Sys.argv)) in
|
||||
let ocamlmktop = Sys.executable_name in
|
||||
let ocamlc = Filename.(quote (concat (dirname ocamlmktop) "ocamlc")) in
|
||||
exit(Sys.command(ocamlc ^ " -I +compiler-libs -linkall ocamlcommon.cma \
|
||||
ocamlbytecomp.cma ocamltoplevel.cma "
|
||||
^ args ^ " topstart.cmo"))
|
||||
(* On Windows Sys.command calls system() which in turn calls 'cmd.exe /c'.
|
||||
cmd.exe has special quoting rules (see 'cmd.exe /?' for details).
|
||||
Short version: if the string passed to cmd.exe starts with '"',
|
||||
the first and last '"' are removed *)
|
||||
let ocamlc,extra_quote =
|
||||
if Sys.win32 then "ocamlc.exe","\"" else "ocamlc",""
|
||||
in
|
||||
let ocamlc = Filename.(quote (concat (dirname ocamlmktop) ocamlc)) in
|
||||
let cmdline =
|
||||
extra_quote ^ ocamlc ^ " -I +compiler-libs -linkall ocamlcommon.cma " ^
|
||||
"ocamlbytecomp.cma ocamltoplevel.cma " ^ args ^ " topstart.cmo" ^
|
||||
extra_quote
|
||||
in
|
||||
exit(Sys.command cmdline)
|
||||
|
|
Loading…
Reference in New Issue