
"Jonathan Wakely" <cow@compsoc.man.ac.uk> wrote in message news:20050509082256.GB43951@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