Feature request: Path append operators for strings
TommiT
tommitissari at hotmail.com
Tue Jul 2 13:24:35 PDT 2013
On Tuesday, 2 July 2013 at 19:56:20 UTC, Jonathan M Davis wrote:
> On Tuesday, July 02, 2013 21:46:26 TommiT wrote:
>> How would you feel about adding the '/' binary operator and the
>> '/=' assignment operator for strings, wstrings and dstrings?
>> The
>> operators would behave the same way as they do with
>> boost::filesystem::path objects:
>>
>> http://www.boost.org/doc/libs/1_54_0/libs/filesystem/doc/reference.html#path
>> -appends
>>
>> In short (and omitting some details) code such as:
>>
>> string s = "C:\\Users" / "John";
>>
>> ...would be the same as:
>>
>> string s = "C:\\Users" ~ std.path.dirSeparator ~ "John";
>
> That's what std.path.buildPath is for.
>
> - Jonathan M Davis
Oh, I hadn't noticed that function. I don't know about its
behaviour of dropping path components situated before a rooted
path component. Throwing an Exception would seem like a better
behaviour in that situation.
More information about the Digitalmars-d
mailing list