forked from qt-creator/qt-creator
Qmake: Fix wildcard expansion for absolute paths
Wildcard expansion for e.g. deployment purposes was implemented, but
accidentally only for relative file paths.
Amends 9e32603c3d
.
Fixes: QTCREATORBUG-24695
Change-Id: Iab5c761ad68c2d4facecef5b44e6e50e66ed4941
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
@@ -86,32 +86,32 @@ QVector<ProFileEvaluator::SourceFile> ProFileEvaluator::fixifiedValues(
|
|||||||
QVector<SourceFile> result;
|
QVector<SourceFile> result;
|
||||||
foreach (const ProString &str, d->values(ProKey(variable))) {
|
foreach (const ProString &str, d->values(ProKey(variable))) {
|
||||||
const QString &el = d->m_option->expandEnvVars(str.toQString());
|
const QString &el = d->m_option->expandEnvVars(str.toQString());
|
||||||
if (IoUtils::isAbsolutePath(el)) {
|
const QString fn = IoUtils::isAbsolutePath(el)
|
||||||
result << SourceFile{QDir::cleanPath(el), str.sourceFile()};
|
? QDir::cleanPath(el) : QDir::cleanPath(baseDirectory + QLatin1Char('/') + el);
|
||||||
|
if (IoUtils::exists(fn)) {
|
||||||
|
result << SourceFile{fn, str.sourceFile()};
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QStringView fileNamePattern;
|
||||||
|
if (expandWildcards) {
|
||||||
|
fileNamePattern = IoUtils::fileName(fn);
|
||||||
|
expandWildcards = fileNamePattern.contains('*') || fileNamePattern.contains('?');
|
||||||
|
}
|
||||||
|
if (expandWildcards) {
|
||||||
|
const QString patternBaseDir = IoUtils::pathName(fn).toString();
|
||||||
|
const QDir::Filters filters = QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot;
|
||||||
|
for (const QString &fileName : QDir(patternBaseDir).entryList(
|
||||||
|
QStringList(fileNamePattern.toString()), filters)) {
|
||||||
|
const QString fullFilePath
|
||||||
|
= QDir::cleanPath(patternBaseDir + '/' + fileName);
|
||||||
|
result << SourceFile({fullFilePath, str.sourceFile()});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
QString fn = QDir::cleanPath(baseDirectory + QLatin1Char('/') + el);
|
if (IoUtils::isAbsolutePath(el)) {
|
||||||
if (IoUtils::exists(fn)) {
|
|
||||||
result << SourceFile{fn, str.sourceFile()};
|
result << SourceFile{fn, str.sourceFile()};
|
||||||
} else {
|
} else {
|
||||||
QStringView fileNamePattern;
|
result << SourceFile{QDir::cleanPath(buildDirectory + QLatin1Char('/') + el),
|
||||||
if (expandWildcards) {
|
str.sourceFile()};
|
||||||
fileNamePattern = IoUtils::fileName(fn);
|
|
||||||
expandWildcards = fileNamePattern.contains('*')
|
|
||||||
|| fileNamePattern.contains('?');
|
|
||||||
}
|
|
||||||
if (expandWildcards) {
|
|
||||||
const QString patternBaseDir = IoUtils::pathName(fn).toString();
|
|
||||||
const QDir::Filters filters = QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot;
|
|
||||||
for (const QString &fileName : QDir(patternBaseDir).entryList(
|
|
||||||
QStringList(fileNamePattern.toString()), filters)) {
|
|
||||||
const QString fullFilePath
|
|
||||||
= QDir::cleanPath(patternBaseDir + '/' + fileName);
|
|
||||||
result << SourceFile({fullFilePath, str.sourceFile()});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
result << SourceFile{QDir::cleanPath(buildDirectory + QLatin1Char('/') + el),
|
|
||||||
str.sourceFile()};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user