diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index e962cc7215..a66599352f 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -580,9 +580,6 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml) int numErrorsAllowed = this->MaxErrors; int numWarningsAllowed = this->MaxWarnings; std::string srcdir = this->CTest->GetCTestConfiguration("SourceDirectory"); - // make sure the source dir is in the correct case on windows - // via a call to collapse full path. - srcdir = cmStrCat(cmSystemTools::CollapseFullPath(srcdir), '/'); for (it = ew.begin(); it != ew.end() && (numErrorsAllowed || numWarningsAllowed); it++) { cmCTestBuildErrorWarning* cm = &(*it); @@ -613,8 +610,9 @@ void cmCTestBuildHandler::GenerateXMLLogScraped(cmXMLWriter& xml) } } else { // make sure it is a full path with the correct case - cm->SourceFile = cmSystemTools::CollapseFullPath(cm->SourceFile); - cmSystemTools::ReplaceString(cm->SourceFile, srcdir.c_str(), ""); + cm->SourceFile = + cmSystemTools::ToNormalizedPathOnDisk(cm->SourceFile); + cmSystemTools::ReplaceString(cm->SourceFile, srcdir, ""); } cm->LineNumber = atoi(re->match(rit.LineIndex).c_str()); break; diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 99c5a2b2c7..3a5ec0442d 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -146,7 +146,7 @@ std::string cmCTestGIT::FindTopDir() !cdup.empty()) { top_dir += "/"; top_dir += cdup; - top_dir = cmSystemTools::CollapseFullPath(top_dir); + top_dir = cmSystemTools::ToNormalizedPathOnDisk(top_dir); } return top_dir; } diff --git a/Source/CTest/cmCTestRunScriptCommand.cxx b/Source/CTest/cmCTestRunScriptCommand.cxx index d11f96619a..38953eab05 100644 --- a/Source/CTest/cmCTestRunScriptCommand.cxx +++ b/Source/CTest/cmCTestRunScriptCommand.cxx @@ -5,6 +5,7 @@ #include "cmCTestScriptHandler.h" #include "cmExecutionStatus.h" #include "cmMakefile.h" +#include "cmSystemTools.h" bool cmCTestRunScriptCommand::InitialPass(std::vector const& args, cmExecutionStatus& status) @@ -36,7 +37,8 @@ bool cmCTestRunScriptCommand::InitialPass(std::vector const& args, ++i; } else { int ret; - cmCTestScriptHandler::RunScript(this->CTest, this->Makefile, args[i], + cmCTestScriptHandler::RunScript(this->CTest, this->Makefile, + cmSystemTools::CollapseFullPath(args[i]), !np, &ret); this->Makefile->AddDefinition(returnVariable, std::to_string(ret)); } diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index f933b6a785..be298faf4c 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -74,9 +74,8 @@ int cmCTestScriptHandler::ProcessHandler() int res = 0; for (size_t i = 0; i < this->ConfigurationScripts.size(); ++i) { // for each script run it - res |= this->RunConfigurationScript( - cmSystemTools::CollapseFullPath(this->ConfigurationScripts[i]), - this->ScriptProcessScope[i]); + res |= this->RunConfigurationScript(this->ConfigurationScripts[i], + this->ScriptProcessScope[i]); } if (res) { return -1; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index eaa06e52ef..b213e97d35 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1786,7 +1786,7 @@ std::string cmCTestTestHandler::FindExecutable( for (unsigned int ai = 0; ai < attempted.size() && fullPath.empty(); ++ai) { // first check without exe extension if (cmSystemTools::FileExists(attempted[ai], true)) { - fullPath = cmSystemTools::CollapseFullPath(attempted[ai]); + fullPath = cmSystemTools::ToNormalizedPathOnDisk(attempted[ai]); resultingConfig = attemptedConfigs[ai]; } // then try with the exe extension @@ -1795,7 +1795,7 @@ std::string cmCTestTestHandler::FindExecutable( tempPath = cmStrCat(attempted[ai], cmSystemTools::GetExecutableExtension()); if (cmSystemTools::FileExists(tempPath, true)) { - fullPath = cmSystemTools::CollapseFullPath(tempPath); + fullPath = cmSystemTools::ToNormalizedPathOnDisk(tempPath); resultingConfig = attemptedConfigs[ai]; } else { failed.push_back(tempPath); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index f895aba135..c15075c0ea 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -818,7 +818,7 @@ int cmCTest::ProcessSteps() const std::string currDir = cmSystemTools::GetCurrentWorkingDirectory(); std::string workDir = currDir; if (!this->Impl->TestDir.empty()) { - workDir = cmSystemTools::CollapseFullPath(this->Impl->TestDir); + workDir = cmSystemTools::ToNormalizedPathOnDisk(this->Impl->TestDir); } cmWorkingDirectory changeDir(workDir); @@ -2104,21 +2104,24 @@ int cmCTest::Run(std::vector const& args) [&runScripts, &SRArgumentSpecified](std::string const& script) -> bool { // -SR is an internal argument, -SP should be ignored when it is passed if (!SRArgumentSpecified) { - runScripts.emplace_back(script, false); + runScripts.emplace_back(cmSystemTools::ToNormalizedPathOnDisk(script), + false); } return true; }; auto const dashSR = [&runScripts, &SRArgumentSpecified](std::string const& script) -> bool { SRArgumentSpecified = true; - runScripts.emplace_back(script, true); + runScripts.emplace_back(cmSystemTools::ToNormalizedPathOnDisk(script), + true); return true; }; auto const dash_S = [&runScripts, &SRArgumentSpecified](std::string const& script) -> bool { // -SR is an internal argument, -S should be ignored when it is passed if (!SRArgumentSpecified) { - runScripts.emplace_back(script, true); + runScripts.emplace_back(cmSystemTools::ToNormalizedPathOnDisk(script), + true); } return true; }; @@ -2274,9 +2277,9 @@ int cmCTest::Run(std::vector const& args) return false; } this->Impl->BuildAndTest.SourceDir = - cmSystemTools::CollapseFullPath(dirList[0]); + cmSystemTools::ToNormalizedPathOnDisk(dirList[0]); this->Impl->BuildAndTest.BinaryDir = - cmSystemTools::CollapseFullPath(dirList[1]); + cmSystemTools::ToNormalizedPathOnDisk(dirList[1]); cmSystemTools::MakeDirectory(this->Impl->BuildAndTest.BinaryDir); return true; } }, @@ -2847,7 +2850,7 @@ int cmCTest::ExecuteTests() const std::string currDir = cmSystemTools::GetCurrentWorkingDirectory(); std::string workDir = currDir; if (!this->Impl->TestDir.empty()) { - workDir = cmSystemTools::CollapseFullPath(this->Impl->TestDir); + workDir = cmSystemTools::ToNormalizedPathOnDisk(this->Impl->TestDir); } cmWorkingDirectory changeDir(workDir); @@ -3039,10 +3042,9 @@ void cmCTest::PopulateCustomInteger(cmMakefile* mf, const std::string& def, std::string cmCTest::GetShortPathToFile(const std::string& cfname) { - const std::string& sourceDir = cmSystemTools::CollapseFullPath( - this->GetCTestConfiguration("SourceDirectory")); - const std::string& buildDir = cmSystemTools::CollapseFullPath( - this->GetCTestConfiguration("BuildDirectory")); + const std::string& sourceDir = + this->GetCTestConfiguration("SourceDirectory"); + const std::string& buildDir = this->GetCTestConfiguration("BuildDirectory"); std::string fname = cmSystemTools::CollapseFullPath(cfname); // Find relative paths to both directories