Path as an object in std.path

Lars T. Kyllingstad public at kyllingen.net
Thu Jun 6 03:43:51 PDT 2013


On Thursday, 6 June 2013 at 10:30:05 UTC, Regan Heath wrote:
> On Thu, 06 Jun 2013 08:05:51 +0100, Lars T. Kyllingstad 
> <public at kyllingen.net> wrote:
>> Paths are usually obtained in string form, and they are 
>> normally passed to other functions and third party libraries 
>> in string form.  Having to convert them to something else just 
>> to do what is, in fact, string manipulations, is just annoying.
>
> Agree 100%.
>
> C# has Path.Combine which builds paths from strings, returning 
> a string and this is good.
>
> It also has System.File and System.Directory static classes 
> with static methods taking string, also good.
>
> But, C# also has System.IO.FileInfo and System.IO.DirectoryInfo 
> which are constructed from a string, and then have methods 
> which mirror the static methods from System.File plus a refresh 
> method to update the cached file attributes etc obtained from 
> the file system.  I find these objects useful.
>
> It would be nice for D to have similar objects, IMO.

It does have a similar type: std.file.DirEntry.
http://dlang.org/phobos/std_file.html#.DirEntry


More information about the Digitalmars-d mailing list