mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-06 19:01:21 +03:00
Don't put crash dumps in Temp on Windows
Well... unless we fail to get the user profile directory. Also put freeze dumps in a more appropriately-named file. Discussed in https://gitlab.com/OpenMW/openmw/-/issues/7455
This commit is contained in:
parent
3364d9a2d6
commit
c21695c951
6 changed files with 40 additions and 19 deletions
|
@ -9,6 +9,12 @@
|
|||
#ifdef _WIN32
|
||||
#include <components/crashcatcher/windows_crashcatcher.hpp>
|
||||
#include <components/windows.hpp>
|
||||
#include <Knownfolders.h>
|
||||
#define FAR
|
||||
#define NEAR
|
||||
#include <Shlobj.h>
|
||||
#undef NEAR
|
||||
#undef FAR
|
||||
#endif
|
||||
|
||||
#include <SDL_messagebox.h>
|
||||
|
@ -304,8 +310,16 @@ int wrapApplication(int (*innerApplication)(int argc, char *argv[]), int argc, c
|
|||
if (const auto env = std::getenv("OPENMW_DISABLE_CRASH_CATCHER"); env == nullptr || std::atol(env) == 0)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
const std::string crashLogName = Misc::StringUtils::lowerCase(appName) + "-crash.dmp";
|
||||
Crash::CrashCatcher crashy(argc, argv, (boost::filesystem::temp_directory_path() / crashLogName).make_preferred().string());
|
||||
const std::string crashDumpName = Misc::StringUtils::lowerCase(appName) + "-crash.dmp";
|
||||
const std::string freezeDumpName = Misc::StringUtils::lowerCase(appName) + "-freeze.dmp";
|
||||
boost::filesystem::path dumpDirectory = boost::filesystem::temp_directory_path();
|
||||
PWSTR userProfile = nullptr;
|
||||
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Profile, 0, nullptr, &userProfile)))
|
||||
{
|
||||
dumpDirectory = userProfile;
|
||||
}
|
||||
CoTaskMemFree(userProfile);
|
||||
Crash::CrashCatcher crashy(argc, argv, (dumpDirectory / crashDumpName).make_preferred().string(), (dumpDirectory / freezeDumpName).make_preferred().string());
|
||||
#else
|
||||
const std::string crashLogName = Misc::StringUtils::lowerCase(appName) + "-crash.log";
|
||||
// install the crash handler as soon as possible. note that the log path
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue