crash: add crash reporter

This commit is contained in:
outfoxxed 2024-08-20 00:41:20 -07:00
parent 5040f3796c
commit fe1d15e8f6
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
23 changed files with 1118 additions and 315 deletions

View file

@ -9,6 +9,8 @@
#include <qtenvironmentvariables.h>
#include <unistd.h>
#include "common.hpp"
Q_LOGGING_CATEGORY(logPaths, "quickshell.paths", QtWarningMsg);
QsPaths* QsPaths::instance() {
@ -18,6 +20,15 @@ QsPaths* QsPaths::instance() {
void QsPaths::init(QString shellId) { QsPaths::instance()->shellId = std::move(shellId); }
QDir QsPaths::crashDir(const QString& shellId, const QDateTime& launchTime) {
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
dir = QDir(dir.filePath("crashes"));
dir = QDir(dir.filePath(shellId));
dir = QDir(dir.filePath(QString("run-%1").arg(launchTime.toMSecsSinceEpoch())));
return dir;
}
QDir* QsPaths::cacheDir() {
if (this->cacheState == DirState::Unknown) {
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
@ -73,7 +84,7 @@ QDir* QsPaths::instanceRunDir() {
this->instanceRunState = DirState::Failed;
} else {
this->mInstanceRunDir =
runtimeDir->filePath(QString("run-%1").arg(QDateTime::currentMSecsSinceEpoch()));
runtimeDir->filePath(QString("run-%1").arg(qs::Common::LAUNCH_TIME.toMSecsSinceEpoch()));
qCDebug(logPaths) << "Initialized instance runtime path:" << this->mInstanceRunDir.path();