Commit a13a5c94 authored by Brad King's avatar Brad King

Replace use of CollapseCombinedPath with CollapseFullPath

`CollapseCombinedPath` was introduced by commit 551d3343 (cmDependsC:
Collapse relative include paths, 2013-06-19, v2.8.12~237^2) where the
existing `CollapseFullPath` should have been used instead.  Then its use
proliferated slightly.  Since `CollapseCombinedPath` is less widely used
and less robust (see issue #19049), use `CollapseFullPath` everywhere
instead.

Issue: #19050
parent d2101e94
...@@ -195,7 +195,7 @@ bool DebGenerator::generateDataTar() const ...@@ -195,7 +195,7 @@ bool DebGenerator::generateDataTar() const
// XXX/application/usr/bin/myprogram with GEN_WDIR=XXX/application // XXX/application/usr/bin/myprogram with GEN_WDIR=XXX/application
// should not add XXX/application // should not add XXX/application
orderedFiles.insert(currentPath); orderedFiles.insert(currentPath);
currentPath = cmSystemTools::CollapseCombinedPath(currentPath, ".."); currentPath = cmSystemTools::CollapseFullPath("..", currentPath);
} }
} }
......
...@@ -325,8 +325,7 @@ int cmCPackFreeBSDGenerator::PackageFiles() ...@@ -325,8 +325,7 @@ int cmCPackFreeBSDGenerator::PackageFiles()
ONE_PACKAGE_PER_COMPONENT); ONE_PACKAGE_PER_COMPONENT);
} }
std::string output_dir = std::string output_dir = cmSystemTools::CollapseFullPath("../", toplevel);
cmSystemTools::CollapseCombinedPath(toplevel, "../");
pkg_create_from_manifest(output_dir.c_str(), ::TXZ, toplevel.c_str(), pkg_create_from_manifest(output_dir.c_str(), ::TXZ, toplevel.c_str(),
manifestname.c_str(), nullptr); manifestname.c_str(), nullptr);
......
...@@ -150,7 +150,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, ...@@ -150,7 +150,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
// Construct the name of the file as if it were in the current // Construct the name of the file as if it were in the current
// include directory. Avoid using a leading "./". // include directory. Avoid using a leading "./".
std::string tmpPath = std::string tmpPath =
cmSystemTools::CollapseCombinedPath(iPath, current.FileName); cmSystemTools::CollapseFullPath(current.FileName, iPath);
// Look for the file in this location. // Look for the file in this location.
if (cmSystemTools::FileExists(tmpPath, true)) { if (cmSystemTools::FileExists(tmpPath, true)) {
...@@ -362,7 +362,7 @@ void cmDependsC::Scan(std::istream& is, const std::string& directory, ...@@ -362,7 +362,7 @@ void cmDependsC::Scan(std::istream& is, const std::string& directory,
// must check for the file in the directory containing the // must check for the file in the directory containing the
// file we are scanning. // file we are scanning.
entry.QuotedLocation = entry.QuotedLocation =
cmSystemTools::CollapseCombinedPath(directory, entry.FileName); cmSystemTools::CollapseFullPath(entry.FileName, directory);
} }
// Queue the file if it has not yet been encountered and it // Queue the file if it has not yet been encountered and it
......
...@@ -287,7 +287,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout, ...@@ -287,7 +287,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
if (l.compare(0, 2, "-l") == 0) { if (l.compare(0, 2, "-l") == 0) {
fout << " \"" << l << "\"" << std::endl; fout << " \"" << l << "\"" << std::endl;
} else { } else {
std::string rl = cmSystemTools::CollapseCombinedPath(cbd, l); std::string rl = cmSystemTools::CollapseFullPath(l, cbd);
fout << " -l\"" << rl << "\"" << std::endl; fout << " -l\"" << rl << "\"" << std::endl;
} }
} }
......
...@@ -185,8 +185,7 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd, ...@@ -185,8 +185,7 @@ void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd,
} }
} else { } else {
std::string tryPath; std::string tryPath;
/* CollapseCombinedPath will check if ts is an absolute path */ tryPath = cmSystemTools::CollapseFullPath(ts, tsd);
tryPath = cmSystemTools::CollapseCombinedPath(tsd, ts);
if (!cmSystemTools::FileExists(tryPath)) { if (!cmSystemTools::FileExists(tryPath)) {
std::string msg = "GHS toolset \"" + tryPath + "\" not found."; std::string msg = "GHS toolset \"" + tryPath + "\" not found.";
cmSystemTools::Error(msg); cmSystemTools::Error(msg);
......
...@@ -309,7 +309,7 @@ void cmQtAutoGen::RccListConvertFullPath(std::string const& qrcFileDir, ...@@ -309,7 +309,7 @@ void cmQtAutoGen::RccListConvertFullPath(std::string const& qrcFileDir,
std::vector<std::string>& files) std::vector<std::string>& files)
{ {
for (std::string& entry : files) { for (std::string& entry : files) {
std::string tmp = cmSystemTools::CollapseCombinedPath(qrcFileDir, entry); std::string tmp = cmSystemTools::CollapseFullPath(entry, qrcFileDir);
entry = std::move(tmp); entry = std::move(tmp);
} }
} }
...@@ -158,11 +158,11 @@ std::string cmQtAutoGenerator::FileSystem::GetRealPath( ...@@ -158,11 +158,11 @@ std::string cmQtAutoGenerator::FileSystem::GetRealPath(
return cmSystemTools::GetRealPath(filename); return cmSystemTools::GetRealPath(filename);
} }
std::string cmQtAutoGenerator::FileSystem::CollapseCombinedPath( std::string cmQtAutoGenerator::FileSystem::CollapseFullPath(
std::string const& dir, std::string const& file) std::string const& file, std::string const& dir)
{ {
std::lock_guard<std::mutex> lock(Mutex_); std::lock_guard<std::mutex> lock(Mutex_);
return cmSystemTools::CollapseCombinedPath(dir, file); return cmSystemTools::CollapseFullPath(file, dir);
} }
void cmQtAutoGenerator::FileSystem::SplitPath( void cmQtAutoGenerator::FileSystem::SplitPath(
......
...@@ -77,9 +77,9 @@ public: ...@@ -77,9 +77,9 @@ public:
// -- Paths // -- Paths
/// @brief Wrapper for cmSystemTools::GetRealPath /// @brief Wrapper for cmSystemTools::GetRealPath
std::string GetRealPath(std::string const& filename); std::string GetRealPath(std::string const& filename);
/// @brief Wrapper for cmSystemTools::CollapseCombinedPath /// @brief Wrapper for cmSystemTools::CollapseFullPath
std::string CollapseCombinedPath(std::string const& dir, std::string CollapseFullPath(std::string const& file,
std::string const& file); std::string const& dir);
/// @brief Wrapper for cmSystemTools::SplitPath /// @brief Wrapper for cmSystemTools::SplitPath
void SplitPath(const std::string& p, std::vector<std::string>& components, void SplitPath(const std::string& p, std::vector<std::string>& components,
bool expand_home_dir = true); bool expand_home_dir = true);
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
std::string cmQtAutoGeneratorMocUic::BaseSettingsT::AbsoluteBuildPath( std::string cmQtAutoGeneratorMocUic::BaseSettingsT::AbsoluteBuildPath(
std::string const& relativePath) const std::string const& relativePath) const
{ {
return FileSys->CollapseCombinedPath(AutogenBuildDir, relativePath); return FileSys->CollapseFullPath(relativePath, AutogenBuildDir);
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment