summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-01-02 12:46:26 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-15 12:40:01 +0100
commitf3d5c6986e69a9701b79058faf655804ce8414ad (patch)
tree0bd08336c9d6d765d8f2436aa6099c6976176b06
parent527f0f0a5818141e688e62b1b59555b61cbbb8ec (diff)
downloadqttools-f3d5c6986e69a9701b79058faf655804ce8414ad.tar.gz
androiddeployqt: Always overwrite user files
The Android files in the project should always overwrite the equivalents in the template, even if the template files have been modified after the project files. Otherwise an old project could stop working when Qt was updated. Task-number: QTBUG-35147 [ChangeLog][Android][QTBUG-35147] Make sure Android files in the project always overwrite the equivalent files in the project template. Change-Id: I4c38061501cbcaa1061e376e7b49a1a0efe596cf Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
-rw-r--r--src/androiddeployqt/main.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/androiddeployqt/main.cpp b/src/androiddeployqt/main.cpp
index 9191b3e0c..890ec9476 100644
--- a/src/androiddeployqt/main.cpp
+++ b/src/androiddeployqt/main.cpp
@@ -388,13 +388,18 @@ bool alwaysOverwritableFile(const QString &fileName)
|| fileName.endsWith(QLatin1String("/src/org/qtproject/qt5/android/bindings/QtActivity.java")));
}
-bool copyFileIfNewer(const QString &sourceFileName, const QString &destinationFileName, bool verbose)
+bool copyFileIfNewer(const QString &sourceFileName,
+ const QString &destinationFileName,
+ bool verbose,
+ bool forceOverwrite = false)
{
if (QFile::exists(destinationFileName)) {
QFileInfo destinationFileInfo(destinationFileName);
QFileInfo sourceFileInfo(sourceFileName);
- if (sourceFileInfo.lastModified() <= destinationFileInfo.lastModified() && !alwaysOverwritableFile(destinationFileName)) {
+ if (!forceOverwrite
+ && sourceFileInfo.lastModified() <= destinationFileInfo.lastModified()
+ && !alwaysOverwritableFile(destinationFileName)) {
if (verbose)
fprintf(stdout, " -- Skipping file %s. Same or newer file already in place.\n", qPrintable(sourceFileName));
return true;
@@ -636,7 +641,7 @@ bool readInputFile(Options *options)
return true;
}
-bool copyFiles(const QDir &sourceDirectory, const QDir &destinationDirectory, bool verbose)
+bool copyFiles(const QDir &sourceDirectory, const QDir &destinationDirectory, bool verbose, bool forceOverwrite = false)
{
QFileInfoList entries = sourceDirectory.entryInfoList(QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs);
foreach (QFileInfo entry, entries) {
@@ -647,11 +652,11 @@ bool copyFiles(const QDir &sourceDirectory, const QDir &destinationDirectory, bo
return false;
}
- if (!copyFiles(dir, QDir(destinationDirectory.path() + QLatin1String("/") + dir.dirName()), verbose))
+ if (!copyFiles(dir, QDir(destinationDirectory.path() + QLatin1String("/") + dir.dirName()), verbose, forceOverwrite))
return false;
} else {
QString destination = destinationDirectory.absoluteFilePath(entry.fileName());
- if (!copyFileIfNewer(entry.absoluteFilePath(), destination, verbose))
+ if (!copyFileIfNewer(entry.absoluteFilePath(), destination, verbose, forceOverwrite))
return false;
}
}
@@ -692,7 +697,7 @@ bool copyAndroidSources(const Options &options)
return false;
}
- return copyFiles(sourceDirectory, QDir(options.outputDirectory), options.verbose);
+ return copyFiles(sourceDirectory, QDir(options.outputDirectory), options.verbose, true);
}
bool copyAndroidExtraLibs(const Options &options)