diff --git a/libs/libcommon/src/DateLUT.cpp b/libs/libcommon/src/DateLUT.cpp index ce3e7e32a26..183d003ffe8 100644 --- a/libs/libcommon/src/DateLUT.cpp +++ b/libs/libcommon/src/DateLUT.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include #include @@ -26,7 +26,7 @@ Poco::DigestEngine::Digest calcSHA1(const std::string & path) std::string determineDefaultTimeZone() { - namespace fs = boost::filesystem; + namespace fs = std::filesystem; const char * tzdir_env_var = std::getenv("TZDIR"); fs::path tz_database_path = tzdir_env_var ? tzdir_env_var : "/usr/share/zoneinfo/"; @@ -87,7 +87,10 @@ std::string determineDefaultTimeZone() /// Try the same with full symlinks resolution { - tz_file_path = fs::canonical(tz_file_path, tz_database_path); + if (!tz_file_path.is_absolute()) + tz_file_path = tz_database_path / tz_file_path; + + tz_file_path = fs::canonical(tz_file_path); fs::path relative_path = tz_file_path.lexically_relative(tz_database_path); if (!relative_path.empty() && *relative_path.begin() != ".." && *relative_path.begin() != ".") @@ -109,11 +112,11 @@ std::string determineDefaultTimeZone() { /// Some timezone databases contain copies of toplevel tzdata files in the posix/ directory /// and tzdata files with leap seconds in the right/ directory. Skip them. - candidate_it.no_push(); + candidate_it.disable_recursion_pending(); continue; } - if (candidate_it->status().type() != fs::regular_file || path.filename() == "localtime") + if (!fs::is_regular_file(*candidate_it) || path.filename() == "localtime") continue; if (fs::file_size(path) == tzfile_size && calcSHA1(path.string()) == tzfile_sha1)