summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2013-05-16 13:48:24 +0200
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2013-05-16 15:49:44 +0200
commit4cd58c4d00ed1c091e1e9900bb76ee98f68da81d (patch)
treebd42fe856fe3037827759e7d6e2e812ef5ed2399
parent3dc3bf9a78140a6b4b91297f6a26cb0eb29c19fc (diff)
downloadqttools-4cd58c4d00ed1c091e1e9900bb76ee98f68da81d.tar.gz
windeployqt: Add namefilter to updateFile.
Change-Id: I5dbebef725195ca7c43bc653f5defa52d3b45714 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--src/windeployqt/utils.cpp8
-rw-r--r--src/windeployqt/utils.h9
2 files changed, 10 insertions, 7 deletions
diff --git a/src/windeployqt/utils.cpp b/src/windeployqt/utils.cpp
index 2ab3128b1..58d294a1b 100644
--- a/src/windeployqt/utils.cpp
+++ b/src/windeployqt/utils.cpp
@@ -323,7 +323,8 @@ QStringList findQtPlugins(unsigned pluginTypes, bool debug, Platform platform, Q
}
// Update a file or directory.
-bool updateFile(const QString &sourceFileName, const QString &targetDirectory, QString *errorMessage)
+bool updateFile(const QString &sourceFileName, const QStringList &nameFilters,
+ const QString &targetDirectory, QString *errorMessage)
{
const QFileInfo sourceFileInfo(sourceFileName);
const QString targetFileName = targetDirectory + QLatin1Char('/') + sourceFileInfo.fileName();
@@ -361,8 +362,9 @@ bool updateFile(const QString &sourceFileName, const QString &targetDirectory, Q
}
// Recurse into directory
QDir dir(sourceFileName);
- foreach (const QString &entry, dir.entryList(QDir::AllEntries | QDir::NoDotAndDotDot))
- if (!updateFile(sourceFileName + QLatin1Char('/') + entry, targetFileName, errorMessage))
+ const QStringList allEntries = dir.entryList(nameFilters, QDir::Files) + dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot);
+ foreach (const QString &entry, allEntries)
+ if (!updateFile(sourceFileName + QLatin1Char('/') + entry, nameFilters, targetFileName, errorMessage))
return false;
return true;
} // Source is directory.
diff --git a/src/windeployqt/utils.h b/src/windeployqt/utils.h
index 1a0532e17..8e7a92c54 100644
--- a/src/windeployqt/utils.h
+++ b/src/windeployqt/utils.h
@@ -42,11 +42,9 @@
#ifndef UTILS_H
#define UTILS_H
-#include <QString>
+#include <QStringList>
#include <QMap>
-QT_FORWARD_DECLARE_CLASS(QStringList)
-
enum Platform { Windows, WinRt };
QString findInPath(const QString &file);
@@ -69,7 +67,10 @@ enum QtPluginType {
QStringList findQtPlugins(unsigned pluginTypes, bool debug, Platform platform,
QString *platformPlugin, QString *errorMessage);
-bool updateFile(const QString &sourceFileName, const QString &targetDirectory, QString *errorMessage);
+bool updateFile(const QString &sourceFileName, const QStringList &nameFilters,
+ const QString &targetDirectory, QString *errorMessage);
+inline bool updateFile(const QString &sourceFileName, const QString &targetDirectory, QString *errorMessage)
+{ return updateFile(sourceFileName, QStringList(), targetDirectory, errorMessage); }
bool runProcess(const QString &commandLine, const QString &workingDirectory = QString(),
unsigned long *exitCode = 0, QByteArray *stdOut = 0, QByteArray *stdErr = 0,
QString *errorMessage = 0);