Path as an object in std.path
monarch_dodra
monarchdodra at gmail.com
Fri Jun 7 11:10:17 PDT 2013
On Friday, 7 June 2013 at 17:27:16 UTC, Andrei Alexandrescu wrote:
> On 6/7/13 1:04 PM, monarch_dodra wrote:
>> I think using string as the main form of representation for a
>> path is fine.
>>
>> However, there are times where it is convenient to be able to
>> explode a
>> path into a structure, where each part is clearly separate
>> from the
>> next.
>
> Tuple!(
> string, "drive",
> string[], "folders",
> string, "basename",
> string, "extension"
> )
> parsePath(string path);
>
> string buildPath(string drive, string[] folders, string
> basename, string extension);
>
>
> Andrei
Yeah. That's pretty much more or less what I was describing.
Except "buildPath" would take your (unnamed) tuple type directly.
There'd be also be a "filename" member/ufcs function in there for
convenience.
I think that would be a small, but useful, addition to std.path.
More information about the Digitalmars-d
mailing list