...
try
{
boost::filesystem::path tmp_dir ("tmp",
boost::filesystem::native);
boost::filesystem::remove_all
(tmp_dir);
std::string tmp_path
(tmp_dir.string().c_str());
}
catch (boost::filesystem::filesystem_error
& e)
{
std::cerr << "boost filesystem exception
thrown!" << std::endl;
exit (1);
}
catch
(...)
{
std::cerr << "Exception thrown!" <<
std::endl;
exit (1);
}
No exceptions thrown. The tmp_path constructor fails with an access
violation where the pointer tmp_dir.m_path._Bx is a bad pointer. I would
expect an exception from both the path constructor and the remove_all call,
but they silently fail.
I can change the construction code to look
like the following an it does not affect the situation in any
way:
boost::filesystem::path env_path;
env_path /= "tmp";