iterate over a directory, dealing with permission errors

xray xray at isd.lu
Sun May 23 13:29:26 UTC 2021


On Friday, 18 September 2015 at 13:53:45 UTC, Meta wrote:
> I think you could use std.exception.ifThrown in this case.
>
> foreach(file; dirEntries(args[1], SpanMode.depth)
>                   .ifThrown(DirEntry.init)
>                   .handle!(Exception, RangePrimitive.popFront, 
> (e, r) =>  DirEntry()))
> {
>      writeln(file.name);
> }
>

Hello, is it something that still works today ?
because I have an error :

"no property `ifThrown` for type `std.file.DirIterator"

same if I use handle! directly. Do I need to import some modules ?


More information about the Digitalmars-d mailing list