[Issue 8291] New: dirEntry cannot handle root directories + unhandled exception causes crash

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 24 10:00:49 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8291

           Summary: dirEntry cannot handle root directories + unhandled
                    exception causes crash
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: mp81ss at rambler.ru


--- Comment #0 from Michele Pes <mp81ss at rambler.ru> 2012-06-24 10:03:15 PDT ---
1) Wrong root handling api/params.
To stat a root directory, the "GetFileAttributes" API must be used instead of
"FindFirstFile".
To stat all files in a root dir, "C:\*" must be passed to FindFirstFile.
In all other cases, a path with [back]slash removed can be passed to
"FindFirstFile".
I know this in crazy, if you don't believe me, read CAREFULLY the FindFirstFile
docs.
P.S.:
This should make you see that the dirEntries method may have some problems...

2) Crash
The result of FindFirstFile is "enforced" in _init private method and NOT
CAUGHT in the caller public method dirEntry, and this crashes the client app.
It would be better to throw a FileException in _init and catch+rethrow it in
dirEntry.

Found on 2.059

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list