Better way to test on BOOST_FILESYSTEM_VERSION

This way it also compiles with older versions that
don't define BOOST_FILESYSTEM_VERSION (ie, 1.42).
This commit is contained in:
Aleric Inglewood
2011-06-30 02:50:37 +02:00
parent fa790523d9
commit 5bf3647f46

View File

@@ -63,10 +63,10 @@ LLDirIterator::Impl::Impl(const std::string &dirname, const std::string &mask)
{
mIter = fs::directory_iterator(dir_path);
}
#if BOOST_FILESYSTEM_VERSION == 2
catch (fs::basic_filesystem_error<fs::path>& e)
#else
#if BOOST_FILESYSTEM_VERSION >= 3
catch (fs::filesystem_error& e)
#else
catch (fs::basic_filesystem_error<fs::path>& e)
#endif
{
llerrs << e.what() << llendl;
@@ -112,10 +112,10 @@ bool LLDirIterator::Impl::next(std::string &fname)
while (mIter != end_itr && !found)
{
boost::smatch match;
#if BOOST_FILESYSTEM_VERSION == 2
std::string name = mIter->path().filename();
#else
#if BOOST_FILESYSTEM_VERSION >= 3
std::string name = mIter->path().filename().string();
#else
std::string name = mIter->path().filename();
#endif
if (found = boost::regex_match(name, match, mFilterExp))
{