From b52d9d69603fa430750fe3528aef2400f5edcda2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 19 Mar 2019 10:00:08 -0400 Subject: cmSystemTools: Drop unused CollapseCombinedPath method All call sites have been converted to `CollapseFullPath`, so the now-unused `CollapseCombinedPath` can be removed. Fixes: #19050 --- Source/cmSystemTools.cxx | 30 ------------------------------ Source/cmSystemTools.h | 6 ------ 2 files changed, 36 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index d762106..1e30912 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1510,36 +1510,6 @@ std::string cmSystemTools::ForceToRelativePath(std::string const& local_path, return relative; } -std::string cmSystemTools::CollapseCombinedPath(std::string const& dir, - std::string const& file) -{ - if (dir.empty() || dir == ".") { - return file; - } - - std::vector dirComponents; - std::vector fileComponents; - cmSystemTools::SplitPath(dir, dirComponents); - cmSystemTools::SplitPath(file, fileComponents); - - if (fileComponents.empty()) { - return dir; - } - if (!fileComponents[0].empty()) { - // File is not a relative path. - return file; - } - - std::vector::iterator i = fileComponents.begin() + 1; - while (i != fileComponents.end() && *i == ".." && dirComponents.size() > 1) { - ++i; // Remove ".." file component. - dirComponents.pop_back(); // Remove last dir component. - } - - dirComponents.insert(dirComponents.end(), i, fileComponents.end()); - return cmSystemTools::JoinPath(dirComponents); -} - #ifdef CMAKE_BUILD_WITH_CMAKE bool cmSystemTools::UnsetEnv(const char* value) { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 60e8c18..b5f65c7 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -374,12 +374,6 @@ public: static std::string ForceToRelativePath(std::string const& local_path, std::string const& remote_path); - /** Joins two paths while collapsing x/../ parts - * For example CollapseCombinedPath("a/b/c", "../../d") results in "a/d" - */ - static std::string CollapseCombinedPath(std::string const& dir, - std::string const& file); - #ifdef CMAKE_BUILD_WITH_CMAKE /** Remove an environment variable */ static bool UnsetEnv(const char* value); -- cgit v0.12