summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx24
-rw-r--r--Source/kwsys/SystemTools.cxx20
-rw-r--r--Source/kwsys/SystemTools.hxx.in8
3 files changed, 51 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 110ab56..b6f4e38 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -463,7 +463,11 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
// only report the first 50 warnings and first 50 errors
unsigned short numErrorsAllowed = 50;
unsigned short numWarningsAllowed = 50;
-
+ std::string srcdir = m_CTest->GetDartConfiguration("SourceDirectory");
+ // make sure the source dir is in the correct case on windows
+ // via a call to collapse full path.
+ srcdir = cmSystemTools::CollapseFullPath(srcdir.c_str());
+ srcdir += "/";
for ( it = ew.begin();
it != ew.end() && (numErrorsAllowed || numWarningsAllowed); it++ )
{
@@ -491,6 +495,24 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
if ( re->find(cm->m_Text.c_str() ) )
{
cm->m_SourceFile = re->match(rit->m_FileIndex);
+ // At this point we need to make m_SourceFile relative to
+ // the source root of the project, so cvs links will work
+ cmSystemTools::ConvertToUnixSlashes(cm->m_SourceFile);
+ if(cm->m_SourceFile.find("/.../") != cm->m_SourceFile.npos)
+ {
+ cmSystemTools::ReplaceString(cm->m_SourceFile, "/.../", "");
+ std::string::size_type p = cm->m_SourceFile.find("/");
+ if(p != cm->m_SourceFile.npos)
+ {
+ cm->m_SourceFile = cm->m_SourceFile.substr(p+1, cm->m_SourceFile.size()-p);
+ }
+ }
+ else
+ {
+ // make sure it is a full path with the correct case
+ cm->m_SourceFile = cmSystemTools::CollapseFullPath(cm->m_SourceFile.c_str());
+ cmSystemTools::ReplaceString(cm->m_SourceFile, srcdir.c_str(), "");
+ }
cm->m_LineNumber = atoi(re->match(rit->m_LineIndex).c_str());
break;
}
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index c40d4c5..a0e5e7e 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2228,11 +2228,31 @@ kwsys_stl::string SystemTools::CollapseFullPath(const char* in_path,
// Update the translation table with this potentially new path.
SystemTools::AddTranslationPath(newPath.c_str(), in_path);
SystemTools::CheckTranslationPath(newPath);
+#ifdef _WIN32
+ newPath = SystemTools::GetActualCaseForPath(newPath.c_str());
+#endif
// Return the reconstructed path.
return newPath;
}
//----------------------------------------------------------------------------
+kwsys_stl::string SystemTools::GetActualCaseForPath(const char* p)
+{
+#ifndef _WIN32
+ return p;
+#else
+ std::string path;
+ if(!SystemTools::GetShortPath(p, path))
+ {
+ return path;
+ }
+ char buffer[MAX_PATH+1];
+ ::GetLongPathName(path.c_str(), buffer, MAX_PATH+1);
+ return buffer;
+#endif
+}
+
+//----------------------------------------------------------------------------
void SystemTools::SplitPath(const char* p,
kwsys_stl::vector<kwsys_stl::string>& components)
{
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 0a1d6db..eec2617 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -242,6 +242,14 @@ public:
static const char* GetExecutableExtension();
/**
+ * Given a path that exists on a windows machine, return the
+ * actuall case of the path as it was created. If the file
+ * does not exist path is returned unchanged. This does nothing
+ * on unix but return path.
+ */
+ static kwsys_stl::string GetActualCaseForPath(const char* path);
+
+ /**
* Given the path to a program executable, get the directory part of
* the path with the file stripped off. If there is no directory
* part, the empty string is returned.