Commit 49564401 authored by Christian Kandeler's avatar Christian Kandeler Committed by con
Browse files

Maemo: Fix logic deciding on package rebuilding.

The time stamp check must descend into directories.

Task-number: QTCREATORBUG-2920
Reviewed-by: con
parent c4a8e6da
......@@ -56,6 +56,7 @@
#include <qt4project.h>
#include <qt4target.h>
#include <QtCore/QDateTime>
#include <QtCore/QProcess>
#include <QtCore/QProcessEnvironment>
#include <QtCore/QRegExp>
......@@ -401,9 +402,8 @@ bool MaemoPackageCreationStep::packagingNeeded() const
const int deployableCount = deployables->deployableCount();
for (int i = 0; i < deployableCount; ++i) {
if (packageInfo.lastModified()
<= QFileInfo(deployables->deployableAt(i).localFilePath)
.lastModified())
if (isFileNewerThan(deployables->deployableAt(i).localFilePath,
packageInfo.lastModified()))
return true;
}
......@@ -423,6 +423,25 @@ bool MaemoPackageCreationStep::packagingNeeded() const
return false;
}
bool MaemoPackageCreationStep::isFileNewerThan(const QString &filePath,
const QDateTime &timeStamp) const
{
QFileInfo fileInfo(filePath);
if (!fileInfo.exists() || fileInfo.lastModified() >= timeStamp)
return true;
if (fileInfo.isDir()) {
const QStringList dirContents = QDir(filePath)
.entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
foreach (const QString &curFileName, dirContents) {
const QString curFilePath
= filePath + QLatin1Char('/') + curFileName;
if (isFileNewerThan(curFilePath, timeStamp))
return true;
}
}
return false;
}
QString MaemoPackageCreationStep::packageFilePath() const
{
QString error;
......
......@@ -45,6 +45,7 @@
#include <projectexplorer/buildstep.h>
QT_BEGIN_NAMESPACE
class QDateTime;
class QFile;
class QProcess;
QT_END_NAMESPACE
......@@ -112,6 +113,8 @@ private:
QString targetRoot() const;
static QString nativePath(const QFile &file);
bool packagingNeeded() const;
bool isFileNewerThan(const QString &filePath,
const QDateTime &timeStamp) const;
void raiseError(const QString &shortMsg,
const QString &detailedMsg = QString());
QString buildDirectory() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment