From c9a018adc1dc1a30f37c900af6587172c2ea2c59 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 26 Apr 2023 14:47:02 +0200 Subject: FileInProjectFinder: Fix path analysis The previous code let to all possible paths to be accepted with maximum confidence. Fixes: QTCREATORBUG-29090 Change-Id: I3e0876d2fd1a5636dbe45cf152c8a251316185ff Reviewed-by: hjk Reviewed-by: Artem Sokolovskii Reviewed-by: Tim Jenssen (cherry picked from commit 032c3c1c2b884a5e3dafdbf4ac7e38bdab8dde31) --- src/libs/utils/fileinprojectfinder.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/fileinprojectfinder.cpp b/src/libs/utils/fileinprojectfinder.cpp index f92cb70fa78..6ee3c34becd 100644 --- a/src/libs/utils/fileinprojectfinder.cpp +++ b/src/libs/utils/fileinprojectfinder.cpp @@ -248,7 +248,10 @@ bool FileInProjectFinder::findFileOrDirectory(const FilePath &originalPath, File } } while (prefixToIgnore != -1) { - FilePath candidate = originalPath.resolvePath(m_projectDir); + QString candidateString = originalPath.toFSPathString(); + candidateString.remove(0, prefixToIgnore); + candidateString.prepend(m_projectDir.toString()); + const FilePath candidate = FilePath::fromString(candidateString); const int matchLength = origLength - prefixToIgnore; // FIXME: This might be a worse match than what we find later. if (checkPath(candidate, matchLength, fileHandler, directoryHandler)) { -- cgit v1.2.3