std::string PathResolver::toAbsolute(const std::string& pathStr) const { const boost::filesystem::path path(pathStr); if (path.is_absolute()) return path.string(); const auto absolute = boost::filesystem::absolute(path, _basePath); #if BOOST_VERSION / 100 >= 1060 return absolute.lexically_normal().string(); #else try { // Try to remove the annoying extra dots. This could use // lexically_normal starting from boost 1.60 return boost::filesystem::canonical(absolute).string(); } catch (const boost::filesystem::filesystem_error&) { return absolute.string(); } #endif }
// recently deprecated functions supplied by default path& normalize() { path tmp(lexically_normal()); m_pathname.swap(tmp.m_pathname); return *this; }