From c2b26d91f7b7d3fe8ba10cffbb959cdd853b09d0 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 24 Jun 2016 17:24:16 +0200 Subject: Fix wildcard handling for subdirs Task-number: QTCREATORBUG-16499 Change-Id: I262a9f6a6b0e900f8d53dda417ae26b964bd7609 Reviewed-by: Christian Kandeler --- src/jomlib/parser.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/jomlib/parser.cpp b/src/jomlib/parser.cpp index 25a3ccd..b7b5353 100644 --- a/src/jomlib/parser.cpp +++ b/src/jomlib/parser.cpp @@ -354,10 +354,17 @@ static bool containsWildcard(const QString &str) static QStringList expandWildcards(const QString &dirPath, const QStringList &lst) { QStringList result; - result.reserve(lst.count()); - foreach (const QString &str, lst) { + foreach (QString str, lst) { if (containsWildcard(str)) { - QDirIterator dit(dirPath, QStringList(str)); + QString path = dirPath; + str = QDir::fromNativeSeparators(str); + int idx = str.lastIndexOf(QLatin1Char('/')); + if (idx != -1) { + path += QLatin1Char('/') + str.left(idx); + str.remove(0, idx + 1); + } + + QDirIterator dit(path, QStringList(str)); while (dit.hasNext()) { QString filePath = dit.next(); if (filePath.startsWith(dirPath, Qt::CaseInsensitive)) { @@ -365,7 +372,7 @@ static QStringList expandWildcards(const QString &dirPath, const QStringList &ls if (filePath.startsWith(QLatin1Char('/'))) filePath.remove(0, 1); } - result.append(filePath); + result.append(QDir::toNativeSeparators(filePath)); } } else { result.append(str); -- cgit v1.2.3