summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-04-26 14:47:02 +0200
committerTim Jenssen <tim.jenssen@qt.io>2023-04-26 20:26:47 +0000
commitc9a018adc1dc1a30f37c900af6587172c2ea2c59 (patch)
tree5e1594b773d652d7a2735b8dd85487dd8ccd8ffd
parent96185a26515b3a047cf83006c0a5188dba697dd6 (diff)
downloadqt-creator-c9a018adc1dc1a30f37c900af6587172c2ea2c59.tar.gz
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 <hjk@qt.io> Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> (cherry picked from commit 032c3c1c2b884a5e3dafdbf4ac7e38bdab8dde31)
-rw-r--r--src/libs/utils/fileinprojectfinder.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libs/utils/fileinprojectfinder.cpp b/src/libs/utils/fileinprojectfinder.cpp
index f92cb70fa7..6ee3c34bec 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)) {