diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-09-12 16:48:59 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-10-14 14:17:23 +0000 |
commit | a94452b1991a111ee44c298b9fdf9f63a9513ca5 (patch) | |
tree | aea42ae37b03fc9bbb5518a681ea0f8edd9445b7 /src/qml/qml/qqmltypeloader.cpp | |
parent | 330663c7b6d0faa7d10ec511d58b317a5ec37a19 (diff) |
Fix written time stamp in QML cache files for QRC sources
For loading and verification we compare against the time stamp of the
executable, so we should do the same thing when generating the cache
data.
Task-number: QTBUG-55926
Change-Id: If5922e76b8ae86185f6eacb6aeeb5c3afbc1f8d5
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/qml/qqmltypeloader.cpp')
-rw-r--r-- | src/qml/qml/qqmltypeloader.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 1f1c9d7150..333ac430d3 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -3102,8 +3102,14 @@ QByteArray QQmlDataBlob::Data::readAll(QString *error, qint64 *sourceTimeStamp) *error = f.errorString(); return QByteArray(); } - if (sourceTimeStamp) - *sourceTimeStamp = QFileInfo(f).lastModified().toMSecsSinceEpoch(); + if (sourceTimeStamp) { + QDateTime timeStamp = QFileInfo(f).lastModified(); + // Files from the resource system do not have any time stamps, so fall back to the application + // executable. + if (!timeStamp.isValid()) + timeStamp = QFileInfo(QCoreApplication::applicationFilePath()).lastModified(); + *sourceTimeStamp = timeStamp.toMSecsSinceEpoch(); + } QByteArray data(f.size(), Qt::Uninitialized); if (f.read(data.data(), data.length()) != data.length()) { *error = f.errorString(); |