Possible bug in std.path?

Adam D. Ruppe via Digitalmars-d digitalmars-d at puremagic.com
Thu May 19 15:41:06 PDT 2016


On Thursday, 19 May 2016 at 22:13:36 UTC, Walter Bright wrote:

> Windows command line processing has special handling for " and 
> \. The \ is used to escape the next character, which here is a 
> ". You can see the resulting argument is [my test"]. Note the 
> quote.

Not exactly... it treats \" as a special case, not \ in general.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb776391%28v=vs.85%29.aspx

Quote:

CommandLineToArgvW has a special interpretation of backslash 
characters when they are followed by a quotation mark character 
("), as follows:

     2n backslashes followed by a quotation mark produce n 
backslashes followed by a quotation mark.
     (2n) + 1 backslashes followed by a quotation mark again 
produce n backslashes followed by a quotation mark.
     n backslashes not followed by a quotation mark simply produce 
n backslashes.



So indeed, the OP stumbled upon a weird case of Windows command 
line, but it is really just this one weird case.


More information about the Digitalmars-d mailing list