ProjectExplorer: Clean paths in OutputLineParser::absoluteFilePath()

Fixes: QTCREATORBUG-26422
Change-Id: I350bbd076007647c4de21db08f2b034d654eb812
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2021-10-14 15:25:24 +02:00
parent a746510937
commit 13bca02801
2 changed files with 11 additions and 1 deletions

View File

@@ -136,8 +136,10 @@ bool OutputLineParser::demoteErrorsToWarnings() const
FilePath OutputLineParser::absoluteFilePath(const FilePath &filePath) const FilePath OutputLineParser::absoluteFilePath(const FilePath &filePath) const
{ {
if (filePath.isEmpty() || filePath.toFileInfo().isAbsolute()) if (filePath.isEmpty())
return filePath; return filePath;
if (filePath.toFileInfo().isAbsolute())
return filePath.cleanPath();
FilePaths candidates; FilePaths candidates;
for (const FilePath &dir : searchDirectories()) { for (const FilePath &dir : searchDirectories()) {
FilePath candidate = dir.pathAppended(filePath.toString()); FilePath candidate = dir.pathAppended(filePath.toString());

View File

@@ -1367,6 +1367,14 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
CompileTask(Task::Error, ".pch/Qt6Core5Compat: No such file or directory", ".pch/Qt6Core5Compat"), CompileTask(Task::Error, ".pch/Qt6Core5Compat: No such file or directory", ".pch/Qt6Core5Compat"),
CompileTask(Task::Warning, "-Wformat-security ignored without -Wformat [-Wformat-security]")} CompileTask(Task::Warning, "-Wformat-security ignored without -Wformat [-Wformat-security]")}
<< QString(); << QString();
QTest::newRow("clean path")
<< QString("/home/tim/path/to/sources/./and/more.h:15:22: error: blubb")
<< OutputParserTester::STDERR
<< QString() << QString()
<< Tasks{CompileTask(Task::Error, "blubb", "/home/tim/path/to/sources/and/more.h",
15, 22)}
<< QString();
} }
void ProjectExplorerPlugin::testGccOutputParsers() void ProjectExplorerPlugin::testGccOutputParsers()