diff options
Diffstat (limited to 'src/zen/zen.cpp')
| -rw-r--r-- | src/zen/zen.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/zen/zen.cpp b/src/zen/zen.cpp index 399c43990..7c21035c0 100644 --- a/src/zen/zen.cpp +++ b/src/zen/zen.cpp @@ -32,6 +32,7 @@ #include <zencore/logging.h> #include <zencore/process.h> #include <zencore/scopeguard.h> +#include <zencore/sentryintegration.h> #include <zencore/string.h> #include <zencore/trace.h> #include <zencore/windows.h> @@ -581,6 +582,8 @@ ProgressBar::HasActiveTask() const int main(int argc, char** argv) { + zen::SetCurrentThreadName("main"); + std::vector<std::string> Args; #if ZEN_PLATFORM_WINDOWS LPWSTR RawCommandLine = GetCommandLine(); @@ -838,6 +841,38 @@ main(int argc, char** argv) #endif // ZEN_WITH_TRACE Options.parse_positional({"command"}); +#if ZEN_USE_SENTRY + bool NoSentry = false; + bool SentryAllowPII = false; + Options.add_options()("no-sentry", "Disable Sentry crash handler", cxxopts::value<bool>(NoSentry)->default_value("false")); + Options.add_options()("sentry-allow-personal-info", + "Allow personally identifiable information in sentry crash reports", + cxxopts::value<bool>(SentryAllowPII)->default_value("false")); +#endif + +#if ZEN_USE_SENTRY + SentryIntegration Sentry; + + if (NoSentry == false) + { + std::string SentryDatabasePath = (GetRunningExecutablePath().parent_path() / ".sentry-native").string(); + + ExtendableStringBuilder<512> SB; + for (int i = 0; i < argc; ++i) + { + if (i) + { + SB.Append(' '); + } + + SB.Append(argv[i]); + } + + Sentry.Initialize(SentryDatabasePath, {}, SentryAllowPII, SB.ToString()); + + SentryIntegration::ClearCaches(); + } +#endif const bool IsNullInvoke = (argc == 1); // If no arguments are passed we want to print usage information |