Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-05-09 07:54:31


"Jonathan Wakely" <cow_at_[hidden]> wrote in message
news:20050509082256.GB43951_at_compsoc.man.ac.uk...
> On Mon, May 09, 2005 at 12:05:35PM +1000, Mathew Robertson wrote:
>
>> > I'm only partially convinced. How useful is knowing that you can
>> > ifstream a
>> > directory? The only cases I can think of are so system specific that I
>> > have
>> > trouble seeing them in the context of Boost.Filesystem.
>>
>> ReiserFS version 4 supports opening a directory as a file. eg:
>
> FreeBSD and Solaris both allow opening a directory (read-only) with
> open(2) and reading from it with read(2) on their default FS types.
>
> If you know the format of the directory and want to write a non-portable
> app that reads it directly you could use an ifstream to do so, in
> theory.

Sure, but it seems like you can only use that facility on a system you
already have prior knowledge about. Part of that knowledge could come from
::stat(), either directly or wrapped in a call to
boost::filesystem::status().

But if stat() doesn't report both S_ISDIR and S_ISREG true at the same time,
there isn't any way to practically implement status(), even if you buy the
argument that reporting both would be desirable.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk