don't change timestamp of unchanged files

Change-Id: Ifa5c15a37d072c6c8edb50f8a4343d99ee0dccf9
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Oswald Buddenhagen 2013-07-15 16:46:28 +02:00 committed by The Qt Project
parent ca645afdc4
commit 922df2c233

View File

@ -4235,6 +4235,12 @@ FileWriter::FileWriter(const QString &name)
bool FileWriter::flush()
{
QTextStream::flush();
QFile oldFile(m_name);
if (oldFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
if (oldFile.readAll() == m_buffer.data())
return true;
oldFile.close();
}
QString dir = QFileInfo(m_name).absolutePath();
if (!QDir().mkpath(dir)) {
cout << "Cannot create directory " << qPrintable(QDir::toNativeSeparators(dir)) << ".\n";