Possible bug in std.path?

Vladimir Panteleev via Digitalmars-d digitalmars-d at puremagic.com
Thu May 19 12:40:16 PDT 2016


On Thursday, 19 May 2016 at 15:25:02 UTC, Kagamin wrote:
> On Thursday, 19 May 2016 at 14:53:21 UTC, Steven Schveighoffer 
> wrote:
>> Then complain to Microsoft :) This is Microsoft's command 
>> shell sending that parameter to your program.
>
> This is how CommandLineToArgvW behaves, which is called by 
> druntime to parse the command line. For example, xcopy parses 
> the command line correctly, e.g. this works as expected:
> xcopy file "..\"

As far as I know, CommandLineToArgvW is *the* correct way to 
parse command-line arguments on Windows. If you do not use it, 
then your program will not work correctly when invoked by other 
programs which assume you use it, and this includes most programs 
which use libraries that accept program arguments as an array 
(which is the correct abstraction for program arguments anyway).

The fact that some standard Windows utilities do not obey this 
convention is more likely a historical artifact from DOS days.



More information about the Digitalmars-d mailing list