#4719: fix (when a bytecode calls ocamlrun, the name of the bytecode is in argv[0]). It would be more robust to have headernt.c extract the full path to the bytecode and pass it explicitly to ocamlrun.exe (as its first argument).
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@13801 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
f6890fbacb
commit
7da2abeceb
|
@ -366,10 +366,18 @@ CAMLexport void caml_main(char **argv)
|
|||
#endif
|
||||
parse_camlrunparam();
|
||||
pos = 0;
|
||||
|
||||
/* First, try argv[0] (when ocamlrun is called by a bytecode program) */
|
||||
exe_name = argv[0];
|
||||
if (caml_executable_name(proc_self_exe, sizeof(proc_self_exe)) == 0)
|
||||
exe_name = proc_self_exe;
|
||||
fd = caml_attempt_open(&exe_name, &trail, 0);
|
||||
|
||||
/* Should we really do that at all? The current executable is ocamlrun
|
||||
itself, it's never a bytecode program. */
|
||||
if (fd < 0 && caml_executable_name(proc_self_exe, sizeof(proc_self_exe)) == 0) {
|
||||
exe_name = proc_self_exe;
|
||||
fd = caml_attempt_open(&exe_name, &trail, 0);
|
||||
}
|
||||
|
||||
if (fd < 0) {
|
||||
pos = parse_command_line(argv);
|
||||
if (argv[pos] == 0)
|
||||
|
|
Loading…
Reference in New Issue