Ranges and Exception handling PR 2724

Jonathan Marler via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 24 16:46:09 PST 2014


On Friday, 21 November 2014 at 16:57:29 UTC, Marco Leise wrote:
> Am Fri, 21 Nov 2014 08:56:17 +0000
> schrieb "Jonathan Marler" <johnnymarler at gmail.com>:
>
>> I actually ran into this problem today when using the 
>> dirEntries function in std.file.  I was attempting to iterate 
>> all the files on my C drive and I got an Access Denied error 
>> which caused the DirIterator to throw an exception.  There's 
>> nothing I could do to catch the exception and continue.  I'm 
>> very glad people are aware of this problem and I'm glad you 
>> are trying to do something about it.
>
> Yep, that dirEntries Exception is quite the show stopper. You
> need to be certain that you have access to all directories
> that it may encounter, which makes it unusable for file system
> roots, but also breaks way to easily with unreadable
> directories in user directories when all you need is a list of
> the _accessible_ files.
>
> The bug reports so far:
>
> std.file: dirEntries-range crashes, when hitting the system 
> folder "System Volume Information"
> https://issues.dlang.org/show_bug.cgi?id=12513
>
> DirEntries throws in foreach
> https://issues.dlang.org/show_bug.cgi?id=12391
>
> dirEntries throws when encountering a "long path" on windows
> https://issues.dlang.org/show_bug.cgi?id=8967

Submitted my idea as a PR in phobos here: 
https://github.com/D-Programming-Language/phobos/pull/2655


More information about the Digitalmars-d mailing list