diff --git a/src/exportmanager.cpp b/src/exportmanager.cpp index 3573f6d..9f6713f 100644 --- a/src/exportmanager.cpp +++ b/src/exportmanager.cpp @@ -333,22 +333,25 @@ ExportResult ExportManager::exportSingleItem(iDescriptorDevice *device, } } - // Clean up outputFile.close(); + ServiceManager::safeAfcFileClose(device, handle, altAfc); - // Set file times after closing the file. - if (!outputFile.setFileTime(modificationTime, + // reopen is required for timestamps + QFile reopen(outputPath); + reopen.open(QIODevice::ReadOnly); + if (modificationTime.isValid()) { + if (!reopen.setFileTime(modificationTime, QFileDevice::FileModificationTime)) { - qWarning() << "Could not set modification time for" << outputPath; + qWarning() << "Could not set modification time for" << outputPath; + } } if (birthTime.isValid()) { - if (!outputFile.setFileTime(birthTime, QFileDevice::FileBirthTime)) { + // fails on linux + if (!reopen.setFileTime(birthTime, QFileDevice::FileBirthTime)) { qWarning() << "Could not set birth time for" << outputPath; } } - ServiceManager::safeAfcFileClose(device, handle, altAfc); - if (totalBytes == 0) { result.errorMessage = "No data read from device file"; outputFile.remove(); // Clean up empty file