summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestBuildHandler.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/CTest/cmCTestBuildHandler.cxx')
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx20
1 files changed, 8 insertions, 12 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 03a3fd3..90c5b2a 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -386,24 +386,20 @@ int cmCTestBuildHandler::ProcessHandler()
if (this->CTest->GetCTestConfiguration("SourceDirectory").size() > 20) {
std::string srcdir =
this->CTest->GetCTestConfiguration("SourceDirectory") + "/";
- for (cc = srcdir.size() - 2; cc > 0; cc--) {
- if (srcdir[cc] == '/') {
- srcdir = srcdir.substr(0, cc + 1);
- break;
- }
+ cc = srcdir.rfind('/', srcdir.size() - 2);
+ if (cc != std::string::npos) {
+ srcdir.resize(cc + 1);
+ this->SimplifySourceDir = std::move(srcdir);
}
- this->SimplifySourceDir = srcdir;
}
if (this->CTest->GetCTestConfiguration("BuildDirectory").size() > 20) {
std::string bindir =
this->CTest->GetCTestConfiguration("BuildDirectory") + "/";
- for (cc = bindir.size() - 2; cc > 0; cc--) {
- if (bindir[cc] == '/') {
- bindir = bindir.substr(0, cc + 1);
- break;
- }
+ cc = bindir.rfind('/', bindir.size() - 2);
+ if (cc != std::string::npos) {
+ bindir.resize(cc + 1);
+ this->SimplifyBuildDir = std::move(bindir);
}
- this->SimplifyBuildDir = bindir;
}
// Ok, let's do the build