std.file new functions/classes
Regan Heath
regan at netwin.co.nz
Sat Mar 11 21:37:07 PST 2006
On Fri, 10 Mar 2006 15:11:47 +0000 (UTC), jicman
<jicman_member at pathlink.com> wrote:
> Gosh! And I was so excited about std.file. ;-) Well, it's a good thing
> that we have std.recls.
There was a thread recently comparing them, you should read it to get
Walter and Matthews opinions on the topic.
> I hope Walter would, someday, also support the same functions that are
> in DirEntry for a file.
It should be fairly simple to write a function to produce a DirEntry, you
could give it a go yourself. Heck, I might give it a go if I have time. I
get the impression Walter is concentrating on the compiler as opposed to
Phobos at the moment which might explain why std.file is a very basic
implementation at present.
> Thanks Regan.
You're welcome.
Regan
> Regan Heath says...
>>
>> On Fri, 10 Mar 2006 07:56:36 +0000 (UTC), jicman
>> <jicman_member at pathlink.com> wrote:
>>> Has anyone figured out how to use the DirEntry entries for std.file?
>>
>> I believe DirEntry is currently only used with listdir, eg.
>>
>> import std.file;
>> import std.stdio;
>>
>> void main()
>> {
>> bool showFile(DirEntry* e)
>> {
>> if (e.isdir()) return true;
>> writefln(" ",e.name);
>> return true;
>> }
>>
>> bool showDir(DirEntry* e)
>> {
>> if (!e.isdir()) return true;
>> writefln(" ",e.name);
>> return true;
>> }
>>
>> writefln("Files:");
>> listdir(".",&showFile);
>> writefln("");
>>
>> writefln("Directories:");
>> listdir(".",&showDir);
>> writefln("");
>> }
>>
>> Regan
>
>
More information about the Digitalmars-d-learn
mailing list