Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-05-11 19:24:45


"Mathew Robertson" <mathew.robertson_at_[hidden]> wrote in message
news:028101c554fc$b9c0cfc0$a901000a_at_mat...

>> 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().
>
> Yes that knowledge _could_ come from status(), but for platforms that dont
> support the named property, the implementation should return something
> useful as a fallback.
>
> However, is_blah() should "do the right thing" on platforms which dont
> support 'blah'

And we have done that where the "right thing" is obvious, such as "false"
for is_symlink() on Windows. I'm not against adding more such "do the right
thing" functions when we can figure out what the "right thing" is.

>> 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.
>
> sure there is... dont use stat() ...

Somehow query for the file system in use, and have a table of what file
systems support reading directories? Try to open a known directory for
reading?

Those don't seem practical to me. But stat() may give the correct results on
at least some systems. I'll try Apple OS X to see what happens.

--Beman


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