diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-12-18 23:04:49 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-12-18 23:04:49 (GMT) |
commit | dad738eab1872837dc70a68732213150755a2d8c (patch) | |
tree | 899eb8129bee4fc9a6c8548a4a83b26e2a64ec83 | |
parent | b3c7fe02a37ac9a657e155af8808404b42fd295f (diff) | |
download | CMake-dad738eab1872837dc70a68732213150755a2d8c.zip CMake-dad738eab1872837dc70a68732213150755a2d8c.tar.gz CMake-dad738eab1872837dc70a68732213150755a2d8c.tar.bz2 |
ENH: Even better. Only replace when path longer than 20 characters. Also replace parent directory. That way it will replace for related projects.
-rw-r--r-- | Source/cmCTest.cxx | 47 |
1 files 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. |