Comment #0 by john.loughran.colvin — 2018-12-18T18:15:21Z
Druntime currently uses CommandLineToArgvW to deal with the command line args on windows, which is a close but not exact match to how the C runtime on windows works.
In the case where the command line looks like this:
"C:\test\"\blah.exe
Druntime using CommandLineToArgvW parses this as
["C:\\test\\", "\\blah.exe"]
note the 2 !!! arguments. The c runtime does
["C:\test\\blah.exe"]
The result is that programs that look at args might behave completely differently depending on exactly how the path to them is written.
I don't see any difference in arguments for D or C++ (VC16). Both produce `C:\test"\blah.exe` for the example in the bug report.
What OS/VC version are you seeing the difference with?
(In reply to Rainer Schuetze from comment #2)
> I don't see any difference in arguments for D or C++ (VC16). Both produce
> `C:\test"\blah.exe` for the example in the bug report.
>
> What OS/VC version are you seeing the difference with?
I'm on Windows 10 x64 with VC 2019. In a test with the following codes:
int main(string[] argv)
{
foreach(i; argv)
writeln(i);
return 0;
}
The cmd.exe raw displays:
C:\Users\XXX>"C:\Users\XXX\source\repos\test\x64\Debug\"\test.exe
C:\Users\XXX\source\repos\test\x64\Debug\
\test.exe
I reproduced this issue.
Comment #5 by r.sagitario — 2020-02-04T08:16:09Z
Ah, it only applies to the program itself, not the additional arguments. Thanks for the clarification.
Comment #6 by robert.schadek — 2024-12-07T13:39:06Z