Boost logo

Boost :

From: Martin Adrian (adrianm_at_[hidden])
Date: 2007-04-18 03:05:35

> What's the rationale of throwing an exception from
> boost::filesystem::exists(somepath); when 'somepath' exists but is locked by
> some other process (at least on Windows)? A simple way to reproduce the
> effect is:

The specific problem with exists is that windows just returns an error ("access
denied"). Based on that you can't determine if the path actually exists. The
problem might be that you don't have access to one of folders above.

A more general problem with the filesystem library is that it is not expressed
clearly enough that exceptions will happen in normal situations. When reading
the docs you easily get the feeling that exceptions are something abnormal that
can be handled in a toplevel catch.

Situation has improved in the new version (in boost 1.34) where non-throwing
operations are possible via the status() function. I still think the new code
makes it more difficult than necessary to avoid exceptions but the author didn't

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