Merge pull request #3100 from keymanapp/fix/windows/sentry-db-location

fix(windows): use consistent sentry db location
This commit is contained in:
Marc Durdin 2020-05-08 11:59:35 +10:00 • committed by GitHub
commit 3fc41c3bac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 9 deletions

View file

@ -299,7 +299,7 @@ begin
end;
o.HandlerPath := ExtractFilePath(FindSentryDLL) + 'crashpad_handler.exe';
o.DatabasePath := TKeymanPaths.ErrorLogPath('sentry-db');
o.DatabasePath := TKeymanPaths.ErrorLogPath + 'sentry-db';
FClient := SentryClientClass.Create(o, ALogger, f);
FClient.OnAfterEvent := ClientAfterEvent;

View file

@ -32,15 +32,21 @@ int keyman_sentry_init(bool is_keyman_developer, const char *logger) {
// Set the sentry-db-directory to a writeable location
char szPath[MAX_PATH + 17]; // length(keyman-sentry-db)+1
GetTempPathA(MAX_PATH, szPath);
char *p = strchr(szPath, 0);
if (p > szPath && *(p - 1) != '\\') {
*p++ = '\\';
*p = 0;
}
strcat_s(szPath, "keyman-sentry-db");
sentry_options_set_database_path(options, szPath);
LPITEMIDLIST pidl;
if (SUCCEEDED(SHGetFolderLocation(0, CSIDL_LOCAL_APPDATA, NULL, 0, &pidl))) {
if (SUCCEEDED(SHGetPathFromIDListA(pidl, szPath))) {
char *p = strchr(szPath, 0);
if (p > szPath && *(p - 1) != '\\') {
*p++ = '\\';
*p = 0;
}
strcat_s(szPath, "sentry-db");
sentry_options_set_database_path(options, szPath);
}
ILFree(pidl);
}
sentry_options_set_release(options, "release-" KEYMAN_VersionWithTag); // matches git tag
sentry_options_set_environment(options, KEYMAN_Environment); // stable, beta, alpha, test, local