mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #15101 from ZehMatt/crashdumps
Dump crash dumps into a different directory and include version in reports
This commit is contained in:
commit
7b7744057e
|
@ -1128,6 +1128,7 @@ namespace OpenRCT2
|
||||||
DIRID::SEQUENCE,
|
DIRID::SEQUENCE,
|
||||||
DIRID::REPLAY,
|
DIRID::REPLAY,
|
||||||
DIRID::LOG_DESYNCS,
|
DIRID::LOG_DESYNCS,
|
||||||
|
DIRID::CRASH,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -228,6 +228,7 @@ const char * PlatformEnvironment::DirectoryNamesOpenRCT2[] =
|
||||||
"heightmap", // HEIGHTMAP
|
"heightmap", // HEIGHTMAP
|
||||||
"replay", // REPLAY
|
"replay", // REPLAY
|
||||||
"desyncs", // DESYNCS
|
"desyncs", // DESYNCS
|
||||||
|
"crash", // CRASH
|
||||||
};
|
};
|
||||||
|
|
||||||
const char * PlatformEnvironment::FileNames[] =
|
const char * PlatformEnvironment::FileNames[] =
|
||||||
|
|
|
@ -49,6 +49,7 @@ namespace OpenRCT2
|
||||||
HEIGHTMAP, // Contains heightmap data.
|
HEIGHTMAP, // Contains heightmap data.
|
||||||
REPLAY, // Contains recorded replays.
|
REPLAY, // Contains recorded replays.
|
||||||
LOG_DESYNCS, // Contains desync reports.
|
LOG_DESYNCS, // Contains desync reports.
|
||||||
|
CRASH, // Contains crash dumps.
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PATHID
|
enum class PATHID
|
||||||
|
|
|
@ -27,10 +27,12 @@
|
||||||
# include "../Context.h"
|
# include "../Context.h"
|
||||||
# include "../Game.h"
|
# include "../Game.h"
|
||||||
# include "../OpenRCT2.h"
|
# include "../OpenRCT2.h"
|
||||||
|
# include "../PlatformEnvironment.h"
|
||||||
# include "../Version.h"
|
# include "../Version.h"
|
||||||
# include "../config/Config.h"
|
# include "../config/Config.h"
|
||||||
# include "../core/Console.hpp"
|
# include "../core/Console.hpp"
|
||||||
# include "../core/Guard.hpp"
|
# include "../core/Guard.hpp"
|
||||||
|
# include "../core/Path.hpp"
|
||||||
# include "../core/String.hpp"
|
# include "../core/String.hpp"
|
||||||
# include "../interface/Screenshot.h"
|
# include "../interface/Screenshot.h"
|
||||||
# include "../localisation/Language.h"
|
# include "../localisation/Language.h"
|
||||||
|
@ -54,6 +56,8 @@ const wchar_t* _wszArchitecture = WSZ(OPENRCT2_ARCHITECTURE);
|
||||||
|
|
||||||
# define BACKTRACE_TOKEN L"742b8d9d70c52df663e4f2449f90039cf9406f89e57ecb90b0f086ba16e33d20"
|
# define BACKTRACE_TOKEN L"742b8d9d70c52df663e4f2449f90039cf9406f89e57ecb90b0f086ba16e33d20"
|
||||||
|
|
||||||
|
using namespace OpenRCT2;
|
||||||
|
|
||||||
// Note: uploading gzipped crash dumps manually requires specifying
|
// Note: uploading gzipped crash dumps manually requires specifying
|
||||||
// 'Content-Encoding: gzip' header in HTTP request, but we cannot do that,
|
// 'Content-Encoding: gzip' header in HTTP request, but we cannot do that,
|
||||||
// so just hope the file name with '.gz' suffix is enough.
|
// so just hope the file name with '.gz' suffix is enough.
|
||||||
|
@ -69,6 +73,7 @@ static bool UploadMinidump(const std::map<std::wstring, std::wstring>& files, in
|
||||||
L"post?format=minidump&token=" BACKTRACE_TOKEN);
|
L"post?format=minidump&token=" BACKTRACE_TOKEN);
|
||||||
std::map<std::wstring, std::wstring> parameters;
|
std::map<std::wstring, std::wstring> parameters;
|
||||||
parameters[L"product_name"] = L"openrct2";
|
parameters[L"product_name"] = L"openrct2";
|
||||||
|
parameters[L"version"] = String::ToWideChar(gVersionInfoFull);
|
||||||
// In case of releases this can be empty
|
// In case of releases this can be empty
|
||||||
if (wcslen(_wszCommitSha1Short) > 0)
|
if (wcslen(_wszCommitSha1Short) > 0)
|
||||||
{
|
{
|
||||||
|
@ -318,9 +323,10 @@ static bool OnCrash(
|
||||||
|
|
||||||
static std::wstring GetDumpDirectory()
|
static std::wstring GetDumpDirectory()
|
||||||
{
|
{
|
||||||
char userDirectory[MAX_PATH];
|
auto env = GetContext()->GetPlatformEnvironment();
|
||||||
platform_get_user_directory(userDirectory, nullptr, sizeof(userDirectory));
|
auto crashPath = env->GetDirectoryPath(DIRBASE::OPENRCT2, DIRID::CRASH);
|
||||||
auto result = String::ToWideChar(userDirectory);
|
|
||||||
|
auto result = String::ToWideChar(crashPath.c_str());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue