diff options
author | Andreas Pakulat <andreas@froglogic.com> | 2014-06-02 10:37:17 +0200 |
---|---|---|
committer | David Schulz <david.schulz@digia.com> | 2014-06-02 12:33:35 +0200 |
commit | cf6e4b8dcbc42adc3c3717728edcaf7952f1784b (patch) | |
tree | 8644bbaaddedc4ca5acaa3f01c33d85093cd6344 /src/plugins/coreplugin/locator | |
parent | 0f05aa42daec491b46195a51eb0cd03bb4aa249a (diff) | |
download | qt-creator-cf6e4b8dcbc42adc3c3717728edcaf7952f1784b.tar.gz |
Fix matching of partial paths on Windows
The paths against which the match is done always have forward slashes (i.e.
uniform separator on all platforms). However the needle passed in has
backward slashes on Windows usually, since this is how the paths are shown
to the users and what is natural on windows too. Even explicitly using
forward slash in the needle does not work here, since then the needle is
not detected as containing a path (hasPathSeparator is false since it uses
the native separator).
Since it seems that the code internally favors the 'uniform' separators
using slashes, simply convert the needle from native to uniform separators
and use the forward slash to decide whether the needle has a path in it.
Side effect of this is that it is now possible to use forward slashes when
typing into the locator UI on windows. The opposite does not work on Unix
though. That could be considered a feature though for cross-platform
developers.
Task-number: QTCREATORBUG-12007
Change-Id: I5064bd9c60936466dd04671ef42a578df26ea7b8
Reviewed-by: David Schulz <david.schulz@digia.com>
Diffstat (limited to 'src/plugins/coreplugin/locator')
-rw-r--r-- | src/plugins/coreplugin/locator/basefilefilter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/coreplugin/locator/basefilefilter.cpp b/src/plugins/coreplugin/locator/basefilefilter.cpp index 920f5b570d..ff6afc088d 100644 --- a/src/plugins/coreplugin/locator/basefilefilter.cpp +++ b/src/plugins/coreplugin/locator/basefilefilter.cpp @@ -49,14 +49,14 @@ QList<LocatorFilterEntry> BaseFileFilter::matchesFor(QFutureInterface<Core::Loca updateFiles(); QList<LocatorFilterEntry> betterEntries; QList<LocatorFilterEntry> goodEntries; - QString needle = trimWildcards(origEntry); + QString needle = trimWildcards(QDir::fromNativeSeparators(origEntry)); const QString lineNoSuffix = EditorManager::splitLineNumber(&needle); QStringMatcher matcher(needle, Qt::CaseInsensitive); const QChar asterisk = QLatin1Char('*'); QRegExp regexp(asterisk + needle+ asterisk, Qt::CaseInsensitive, QRegExp::Wildcard); if (!regexp.isValid()) return betterEntries; - const QChar pathSeparator = QDir::separator(); + const QChar pathSeparator(QLatin1Char('/')); const bool hasPathSeparator = needle.contains(pathSeparator); const bool hasWildcard = needle.contains(asterisk) || needle.contains(QLatin1Char('?')); QStringList searchListPaths; |