Send crash log as comment
authorHannah von Reth <hannah.vonreth@owncloud.com>
Thu, 4 Mar 2021 10:27:41 +0000 (11:27 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Mon, 23 Aug 2021 07:44:34 +0000 (09:44 +0200)
src/crashreporter/main.cpp

index 7d647426f00765acd8951d92cec8228c766c01e5..9d057e05a885e5f31ed96e43b654276cb077895c 100644 (file)
@@ -18,7 +18,9 @@
 #include <libcrashreporter-gui/CrashReporter.h>
 
 #include <QApplication>
+#include <QDir>
 #include <QDebug>
+#include <QFileInfo>
 
 int main(int argc, char *argv[])
 {
@@ -52,6 +54,14 @@ int main(int argc, char *argv[])
     reporter.setWindowTitle(CRASHREPORTER_PRODUCT_NAME);
     reporter.setText("<html><head/><body><p><span style=\" font-weight:600;\">Sorry!</span> " CRASHREPORTER_PRODUCT_NAME " crashed. Please tell us about it! " CRASHREPORTER_PRODUCT_NAME " has created an error report for you that can help improve the stability in the future. You can now send this report directly to the " CRASHREPORTER_PRODUCT_NAME " developers.</p></body></html>");
 
+    const QFileInfo crashLog(QDir::tempPath() + QStringLiteral("/" CRASHREPORTER_PRODUCT_NAME "-crash.log"));
+    if (crashLog.exists()) {
+        QFile inFile(crashLog.filePath());
+        if (inFile.open(QFile::ReadOnly)) {
+            reporter.setComment(inFile.readAll());
+        }
+    }
+
     reporter.setReportData("BuildID", CRASHREPORTER_BUILD_ID);
     reporter.setReportData("ProductName", CRASHREPORTER_PRODUCT_NAME);
     reporter.setReportData("Version", CRASHREPORTER_VERSION_STRING);