BUG: fix for bug 1717 incorrect path sent to dart server

This commit is contained in:
Bill Hoffman 2005-04-07 13:03:47 -04:00
parent a1d7482548
commit fadff33791
3 changed files with 51 additions and 1 deletions

View File

@ -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;
}

View File

@ -2228,10 +2228,30 @@ 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)

View File

@ -241,6 +241,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