[CrashReporting] Match the dump scan to the writer's temp fallback

Review nit: when the handler's SHGetKnownFolderPath lookup fails it writes to
<temp>/../.., but the startup scan looked in QDir::tempPath(), so a dump
produced through the fallback would never be found and its crash would never
offer to be reported. Walk up the same two levels in the scan.

The path is Windows-only (#ifdef Q_OS_WIN); the statements were compiled and
run standalone against Qt 6 to confirm the API use.
This commit is contained in:
Lukas Brübach 2026-10-18 23:25:48 +02:00
parent 1da0c6c7a5
commit f508a4d1bb

View file

@ -467,11 +467,15 @@ int main(int argc, char *argv[])
{
QString crashDumpDir;
#ifdef Q_OS_WIN
// Mirrors the writer's location: %LOCALAPPDATA%/CrashDumps/Cockatrice, with the same
// temp-path fallback the writer uses when the known-folder lookup fails.
// Mirrors the writer's location: %LOCALAPPDATA%/CrashDumps/Cockatrice. When the handler's
// known-folder lookup fails it falls back to <temp>/../.., so the scan has to walk up the
// same two levels; plain QDir::tempPath() would look in a directory nothing ever writes to.
crashDumpDir = QString::fromLocal8Bit(qgetenv("LOCALAPPDATA")) + "/CrashDumps/Cockatrice";
if (qgetenv("LOCALAPPDATA").isEmpty()) {
crashDumpDir = QDir::tempPath();
QDir fallback(QDir::tempPath());
fallback.cdUp();
fallback.cdUp();
crashDumpDir = fallback.absolutePath();
}
#else
crashDumpDir = QDir::tempPath();