Possible bug in std.path?

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu May 19 09:15:06 PDT 2016


On 5/19/16 12:02 PM, Steven Schveighoffer wrote:
> On 5/19/16 11:25 AM, 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 "..\"
>
> Thanks for correcting, this is a difference from posix that I forgot about.
>
> The reason for this (as spelled out in the comments) is to get around
> the poor handling of utf8 by Windows.
>
> I think if you write a C program in Windows, your argv/argc will contain
> .."
>
> You'd have to do the same acrobatics D does to get the original, so I
> don't think this is a problem that we need to solve. Use those low-level
> functions if you wish.

For reference to OP, here is the code that accesses original command 
line, which you can model for your desired behavior:

https://github.com/dlang/druntime/blob/master/src/rt/dmain2.d#L356

-Steve


More information about the Digitalmars-d mailing list