fix:修复导出成功但显示失败的问题

This commit is contained in:
2025-09-23 13:42:55 +08:00
parent 5c44ee7226
commit d8a37114eb

View File

@@ -361,6 +361,14 @@ bool Utils::exportLogs(const QString &targetPath)
bool success = QFile::copy(logFilePath, targetLogPath); bool success = QFile::copy(logFilePath, targetLogPath);
// 额外检查即使QFile::copy返回false也要检查目标文件是否实际存在且大小合理
if (!success) {
QFileInfo targetFileInfo(targetLogPath);
if (targetFileInfo.exists() && targetFileInfo.size() > 0) {
success = true;
}
}
if (success) { if (success) {
writeLog("INFO", QString("Logs exported to: %1").arg(targetLogPath)); writeLog("INFO", QString("Logs exported to: %1").arg(targetLogPath));
} else { } else {