From dad738eab1872837dc70a68732213150755a2d8c Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Thu, 18 Dec 2003 18:04:49 -0500 Subject: ENH: Even better. Only replace when path longer than 20 characters. Also replace parent directory. That way it will replace for related projects. --- Source/cmCTest.cxx | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 8c0190e..d57c350 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1016,34 +1016,37 @@ int cmCTest::BuildDirectory() } int cc; - std::string srcdir = m_DartConfiguration["SourceDirectory"] + "/"; - std::string bindir = m_DartConfiguration["BuildDirectory"] + "/"; - std::string srcdirrep; - std::string bindirrep; - for ( cc = srcdir.size()-2; cc > 0; cc -- ) + if ( m_DartConfiguration["SourceDirectory"].size() > 20 || + m_DartConfiguration["BuildDirectory"].size() > 20 ) { - if ( srcdir[cc] == '/' ) + std::string srcdir = m_DartConfiguration["SourceDirectory"] + "/"; + std::string bindir = m_DartConfiguration["BuildDirectory"] + "/"; + std::string srcdirrep; + std::string bindirrep; + for ( cc = srcdir.size()-2; cc > 0; cc -- ) { - srcdirrep = srcdir.c_str() + cc; - srcdirrep = "/..." + srcdirrep; - break; + if ( srcdir[cc] == '/' ) + { + srcdirrep = srcdir.c_str() + cc; + srcdirrep = "/..." + srcdirrep; + srcdir = srcdir.substr(0, cc+1); + break; + } } - } - for ( cc = bindir.size()-2; cc > 0; cc -- ) - { - if ( bindir[cc] == '/' ) + for ( cc = bindir.size()-2; cc > 0; cc -- ) { - bindirrep = bindir.c_str() + cc; - bindirrep = "/..." + bindirrep; - break; + if ( bindir[cc] == '/' ) + { + bindirrep = bindir.c_str() + cc; + bindirrep = "/..." + bindirrep; + bindir = bindir.substr(0, cc+1); + break; + } } - } - //std::cout << "Use " << srcdirrep.c_str() << std::endl; - //std::cout << "Use " << bindirrep.c_str() << std::endl; - - cmSystemTools::ReplaceString(output, srcdir.c_str(), srcdirrep.c_str()); - cmSystemTools::ReplaceString(output, bindir.c_str(), bindirrep.c_str()); + cmSystemTools::ReplaceString(output, srcdir.c_str(), "/.../"); //srcdirrep.c_str()); + cmSystemTools::ReplaceString(output, bindir.c_str(), "/.../"); //bindirrep.c_str()); + } // Parsing of output for errors and warnings. -- cgit v0.12