Join GitHub today
Sys.executable_name is wrong if executable name contains dots #4719
Original bug ID: 4719
Context: Ocaml 3.11.0 on Windows Vista SP1
The last output is wrong.
Comment author: @alainfrisch
In the same way, compiling in bytecode with "-custom", with a target containing a dot (foo.bar.exe) makes it impossible to run the program from cmd.exe.
I propose to implement caml_executable_name under Windows using GetModuleFileName(NULL, _, _). (Another option would be to rely on _pgmptr / _get_pgmptr, but its documention on MSDN is quite scary about its semantics when the program is not called from the command line.)