Commit 5fc354c4 authored by Nicolas Fella's avatar Nicolas Fella

Simplify code in setDateModified

parent 51e4e399
Pipeline #3563 passed with stage
in 7 minutes and 28 seconds
...@@ -85,13 +85,9 @@ static QString cleanFilename(const QString &filename) ...@@ -85,13 +85,9 @@ static QString cleanFilename(const QString &filename)
void SharePlugin::setDateModified(const QUrl& destination, const qint64 timestamp) void SharePlugin::setDateModified(const QUrl& destination, const qint64 timestamp)
{ {
QFile receivedFile(destination.toLocalFile()); QFile receivedFile(destination.toLocalFile());
if (!receivedFile.exists()) { if (!receivedFile.exists() || !receivedFile.open(QIODevice::ReadWrite | QIODevice::Text)) {
if (!receivedFile.open(QIODevice::ReadWrite | QIODevice::Text)) { return;
QString error_msg = receivedFile.errorString();
return;
}
} }
receivedFile.open(QIODevice::ReadWrite | QIODevice::Text);
receivedFile.setFileTime(QDateTime::fromMSecsSinceEpoch(timestamp), QFileDevice::FileTime(QFileDevice::FileModificationTime)); receivedFile.setFileTime(QDateTime::fromMSecsSinceEpoch(timestamp), QFileDevice::FileTime(QFileDevice::FileModificationTime));
} }
......
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