Fix path to log file.

This commit is contained in:
Roman Telezhynskyi 2024-07-07 18:49:37 +03:00
parent f3329fb130
commit b27ad3016e
5 changed files with 13 additions and 10 deletions

View file

@ -87,7 +87,7 @@ auto main(int argc, char *argv[]) -> int
Q_INIT_RESOURCE(win_dark_theme); // NOLINT Q_INIT_RESOURCE(win_dark_theme); // NOLINT
#ifdef CRASH_REPORTING #ifdef CRASH_REPORTING
InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR).toLower()); InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR));
#endif #endif
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)

View file

@ -86,7 +86,7 @@ auto main(int argc, char *argv[]) -> int
Q_INIT_RESOURCE(win_dark_theme); // NOLINT Q_INIT_RESOURCE(win_dark_theme); // NOLINT
#ifdef CRASH_REPORTING #ifdef CRASH_REPORTING
InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR).toLower()); InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR));
#endif #endif
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)

View file

@ -94,7 +94,7 @@ auto main(int argc, char *argv[]) -> int
Q_INIT_RESOURCE(win_dark_theme); // NOLINT Q_INIT_RESOURCE(win_dark_theme); // NOLINT
#ifdef CRASH_REPORTING #ifdef CRASH_REPORTING
InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR).toLower()); InitializeCrashpad(QStringLiteral(VER_PRODUCTNAME_STR));
#endif #endif
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)

View file

@ -165,7 +165,7 @@ auto GetExecutableDir() -> QString
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto InitializeCrashpad(const QString &appName) -> bool auto InitializeCrashpad(const QString &appName) -> bool
{ {
QScopedPointer<VCommonSettings> const appSettings(AppSettings(appName)); QScopedPointer<VCommonSettings> const appSettings(AppSettings(appName.toLower()));
if (!appSettings->IsSendCrashReport()) if (!appSettings->IsSendCrashReport())
{ {
@ -231,7 +231,7 @@ auto InitializeCrashpad(const QString &appName) -> bool
QMap<std::string, std::string> annotations; QMap<std::string, std::string> annotations;
annotations["format"] = "minidump"; // Required: Crashpad setting to save crash as a annotations["format"] = "minidump"; // Required: Crashpad setting to save crash as a
annotations["database"] = dbName.toStdString(); // Required: BugSplat database annotations["database"] = dbName.toStdString(); // Required: BugSplat database
annotations["product"] = appName.toStdString(); // Required: BugSplat appName annotations["product"] = appName.toLower().toStdString(); // Required: BugSplat appName
annotations["version"] = AppCrashVersion().toStdString(); // Required: BugSplat appVersion annotations["version"] = AppCrashVersion().toStdString(); // Required: BugSplat appVersion
QString clientID = appSettings->GetClientID(); QString clientID = appSettings->GetClientID();

View file

@ -45,7 +45,7 @@ auto LogDirPath(const QString &appName) -> QString
{ {
const auto logs = QStringLiteral("Logs"); const auto logs = QStringLiteral("Logs");
QString logDirPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation); QString const logDirPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
if (logDirPath.isEmpty()) if (logDirPath.isEmpty())
{ {
#if defined(Q_OS_WINDOWS) #if defined(Q_OS_WINDOWS)
@ -55,7 +55,7 @@ auto LogDirPath(const QString &appName) -> QString
#endif #endif
} }
#if defined(Q_OS_WINDOWS) #if defined(Q_OS_WINDOWS)
auto path = QStringList{logDirPath, logs}.join(QDir::separator()); auto path = QStringList{logDirPath, VER_COMPANYNAME_STR, appName, logs}.join(QDir::separator());
#else #else
auto path = QStringList{logDirPath, VER_COMPANYNAME_STR, logs, appName}.join(QDir::separator()); auto path = QStringList{logDirPath, VER_COMPANYNAME_STR, logs, appName}.join(QDir::separator());
#endif #endif
@ -72,9 +72,12 @@ VCrashPaths::VCrashPaths(QString exeDir)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
auto VCrashPaths::GetAttachmentPath(const QString &appName) -> QString auto VCrashPaths::GetAttachmentPath(const QString &appName) -> QString
{ {
return QStringLiteral("%1/%2-pid%3.log") QString path = QStringLiteral("%1/%2-pid%3.log")
.arg(LogDirPath(appName), appName.toLower()) .arg(LogDirPath(appName), appName.toLower())
.arg(QCoreApplication::applicationPid()); .arg(QCoreApplication::applicationPid());
path = QDir::toNativeSeparators(path);
qDebug() << "Crashpad attachment path:" << path;
return path;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------