Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2004-09-09 14:32:28

At 05:12 AM 9/9/2004, Martin wrote:

>The filesystem status operations exists & is_directory will both throw if

>the status of the file can't be determined (access problems or race

CVS for exists() was changed in March to always determine existence or no,
and not to throw.

>I think this makes the operations overly complicated to use since you
>to enclose them in try catch blocks. You normally guard operations that
>use files in some way but it is easy to forget try/catch around exists /

That isn't at all clear to me. I've rarely if ever seen people put
try/catch around is_directory(). The thinking is that throws from
is_directory all represent real errors, so should be caught higher up in
the call tree along with all other general filesystem errors.

>(Noticed that exists has been updated in CVS to return true on error
>probably ok but I think is_directory need to be updated as well.)
>I think a good solution would be to have a non-throwing overload where
>return value in case of error is specified.
>bool is_directory(const tdFS::path& aPath, bool aErrorRet) {
> try { return tdFS::is_directory(aPath); } catch (...) { return
>Another way could be to have a "is_accessable" operation that determines
>the status of the entry can be determined but it will not solve the

Yes, is_accessable() might be useful. But the use cases I can think of are
a bit theoretical. Anyone else have an opinion? I think I'd like to hear
about so real-life needs (rather than theoretical or hypothetical needs)
before deciding.



Boost list run by bdawes at, gregod at, cpdaniel at, john at