From: Joel Rosdahl Date: Fri, 8 Nov 2024 15:36:52 +0000 (+0100) Subject: refactor: Use util::lexically_normal X-Git-Tag: v4.11~49 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=b3f1c19cfb79b2d913fa30d4dd5d23af66d60f38;p=thirdparty%2Fccache.git refactor: Use util::lexically_normal --- diff --git a/src/ccache/config.cpp b/src/ccache/config.cpp index 2cfb300f..e69a9aa2 100644 --- a/src/ccache/config.cpp +++ b/src/ccache/config.cpp @@ -1021,7 +1021,7 @@ Config::set_item(const std::string& key, m_base_dir = value; if (!m_base_dir.empty()) { // The empty string means "disable" verify_absolute_path(m_base_dir); - m_base_dir = m_base_dir.lexically_normal(); + m_base_dir = util::lexically_normal(m_base_dir); } break; diff --git a/src/ccache/util/path.cpp b/src/ccache/util/path.cpp index fb1b8e7f..f23db8a0 100644 --- a/src/ccache/util/path.cpp +++ b/src/ccache/util/path.cpp @@ -83,12 +83,7 @@ make_relative_path(const fs::path& actual_cwd, DEBUG_ASSERT(apparent_cwd.is_absolute()); DEBUG_ASSERT(path.is_absolute()); - fs::path normalized_path = path.lexically_normal(); - if (!normalized_path.has_filename()) { - // Skip trailing slash since fs::equivalent doesn't work otherwise on - // Windows. - normalized_path = normalized_path.parent_path(); - } + fs::path normalized_path = util::lexically_normal(path); fs::path closest_existing_path = normalized_path; std::vector relpath_candidates; fs::path path_suffix; @@ -140,8 +135,8 @@ path_starts_with(const fs::path& path, const fs::path& prefix) // Note: Not all paths on Windows are case insensitive, but for our purposes // (checking whether a path is below the base directory) users will expect // them to be. - fs::path p1 = util::to_lowercase(path.lexically_normal().string()); - fs::path p2 = util::to_lowercase(prefix.lexically_normal().string()); + fs::path p1 = util::to_lowercase(util::lexically_normal(path).string()); + fs::path p2 = util::to_lowercase(util::lexically_normal(prefix).string()); #else const fs::path& p1 = path; const fs::path& p2 = prefix;