fix mac platform sentry no boost and build failed error bug

This commit is contained in:
alves
2025-12-09 18:29:46 +08:00
parent b181ec6ee2
commit 377221f22e

View File

@@ -20,6 +20,8 @@
#ifdef __APPLE__
#include <unistd.h>
#include <mach-o/dyld.h>
#include <libgen.h>
#include <string.h>
#endif
#include <cstdlib>
@@ -64,8 +66,11 @@ void initSentryEx()
}
// Get the directory containing the executable, not the executable path itself
boost::filesystem::path exe_dir = boost::filesystem::path(exe_path).parent_path();
handlerDir = (exe_dir / "crashpad_handler").string();
// Use dirname() to get parent directory (need to copy string as dirname may modify it)
char exe_path_copy[PATH_MAX];
strncpy(exe_path_copy, exe_path, PATH_MAX);
char* exe_dir = dirname(exe_path_copy);
handlerDir = std::string(exe_dir) + "/crashpad_handler";
const char* home_env = getenv("HOME");