Fix not trying hard enough to find the correct file on build errors.

If there are multiple files with the same name, then we try harder to
find the correct one. That is for jom and nmake we have a relative path
so we try to find a file which matches the relative path completly.
Instead of just comparing the last part.
(cherry picked from commit 156db18592)
This commit is contained in:
dt
2009-09-03 15:07:12 +02:00
committed by con
parent e1707414d5
commit 6c63055895
3 changed files with 22 additions and 6 deletions

View File

@@ -26,7 +26,6 @@
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include "makestep.h"
#include "cmakeprojectconstants.h"
#include "cmakeproject.h"

View File

@@ -149,10 +149,26 @@ void AbstractMakeStep::slotAddToTaskWindow(const QString & fn, int type, int lin
}
}
}
if (possibleFiles.count() == 1)
if (possibleFiles.count() == 1) {
filePath = possibleFiles.first().filePath();
else
qWarning() << "Could not find absolute location of file " << filePath;
} else {
// More then one filename, so do a better compare
// Chop of any "../"
while (filePath.startsWith("../"))
filePath = filePath.mid(3);
int count = 0;
QString possibleFilePath;
foreach(const QFileInfo & fi, possibleFiles) {
if (fi.filePath().endsWith(filePath)) {
possibleFilePath = fi.filePath();
++count;
}
}
if (count == 1)
filePath = possibleFilePath;
else
qWarning() << "Could not find absolute location of file " << filePath;
}
}
emit addToTaskWindow(filePath, type, linenumber, description);
}

View File

@@ -31,6 +31,7 @@
#include "projectexplorerconstants.h"
#include <QtCore/QStringList>
#include <QtCore/QDir>
using namespace ProjectExplorer;
@@ -58,7 +59,7 @@ void MsvcParser::stdOutput(const QString & line)
QString lne = line.trimmed();
if (m_compileRegExp.indexIn(lne) > -1 && m_compileRegExp.numCaptures() == 4) {
emit addToTaskWindow(
m_compileRegExp.cap(1), //filename
QDir::cleanPath(m_compileRegExp.cap(1)), //filename
toType(m_compileRegExp.cap(3).toInt()), // PatternType
m_compileRegExp.cap(2).toInt(), //linenumber
m_compileRegExp.cap(4) //description
@@ -70,7 +71,7 @@ void MsvcParser::stdOutput(const QString & line)
fileName.clear();
emit addToTaskWindow(
fileName, //filename
QDir::cleanPath(fileName), //filename
toType(m_linkRegExp.cap(2).toInt()), // pattern type
-1, // line number
m_linkRegExp.cap(3) // description