mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-04 08:46:09 +00:00
Move Sentry class impl to a .cpp file
This commit is contained in:
parent
024cd73f62
commit
6cafec8d06
@ -403,7 +403,9 @@ if(ENABLE_UI)
|
||||
endif()
|
||||
|
||||
set(send_crash_files)
|
||||
if(NOT ENABLE_SENTRY)
|
||||
if(ENABLE_SENTRY)
|
||||
set(send_crash_files sentry_wrapper.cpp)
|
||||
else()
|
||||
set(send_crash_files send_crash.cpp)
|
||||
endif()
|
||||
|
||||
|
59
src/app/sentry_wrapper.cpp
Normal file
59
src/app/sentry_wrapper.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2021 Igara Studio S.A.
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/sentry_wrapper.h"
|
||||
|
||||
#include "app/resource_finder.h"
|
||||
#include "base/string.h"
|
||||
#include "ver/info.h"
|
||||
|
||||
#include "sentry.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
void Sentry::init()
|
||||
{
|
||||
sentry_options_t* options = sentry_options_new();
|
||||
sentry_options_set_dsn(options, SENTRY_DNS);
|
||||
|
||||
std::string release = "aseprite@";
|
||||
release += get_app_version();
|
||||
sentry_options_set_release(options, release.c_str());
|
||||
|
||||
#if _DEBUG
|
||||
sentry_options_set_debug(options, 1);
|
||||
#endif
|
||||
|
||||
setupDirs(options);
|
||||
|
||||
if (sentry_init(options) == 0)
|
||||
m_init = true;
|
||||
}
|
||||
|
||||
Sentry::~Sentry()
|
||||
{
|
||||
if (m_init)
|
||||
sentry_close();
|
||||
}
|
||||
|
||||
void Sentry::setupDirs(sentry_options_t* options)
|
||||
{
|
||||
ResourceFinder rf;
|
||||
rf.includeUserDir("crashdb");
|
||||
std::string dir = rf.getFirstOrCreateDefault();
|
||||
|
||||
#if SENTRY_PLATFORM_WINDOWS
|
||||
sentry_options_set_database_pathw(options, base::from_utf8(dir).c_str());
|
||||
#else
|
||||
sentry_options_set_database_path(options, dir.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace app
|
@ -11,53 +11,17 @@
|
||||
#error ENABLE_SENTRY must be defined
|
||||
#endif
|
||||
|
||||
#include "app/resource_finder.h"
|
||||
#include "base/string.h"
|
||||
|
||||
#include "sentry.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
class Sentry {
|
||||
public:
|
||||
void init()
|
||||
{
|
||||
sentry_options_t* options = sentry_options_new();
|
||||
sentry_options_set_dsn(options, SENTRY_DNS);
|
||||
|
||||
std::string release = "aseprite@";
|
||||
release += get_app_version();
|
||||
sentry_options_set_release(options, release.c_str());
|
||||
|
||||
#if _DEBUG
|
||||
sentry_options_set_debug(options, 1);
|
||||
#endif
|
||||
|
||||
setupDirs(options);
|
||||
|
||||
if (sentry_init(options) == 0)
|
||||
m_init = true;
|
||||
}
|
||||
|
||||
~Sentry()
|
||||
{
|
||||
if (m_init)
|
||||
sentry_close();
|
||||
}
|
||||
void init();
|
||||
~Sentry();
|
||||
|
||||
private:
|
||||
void setupDirs(sentry_options_t* options)
|
||||
{
|
||||
ResourceFinder rf;
|
||||
rf.includeUserDir("crashdb");
|
||||
std::string dir = rf.getFirstOrCreateDefault();
|
||||
|
||||
#if SENTRY_PLATFORM_WINDOWS
|
||||
sentry_options_set_database_pathw(options, base::from_utf8(dir).c_str());
|
||||
#else
|
||||
sentry_options_set_database_path(options, dir.c_str());
|
||||
#endif
|
||||
}
|
||||
void setupDirs(sentry_options_t* options);
|
||||
|
||||
bool m_init = false;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user