Merge pull request #14863 from brad0/openbsd_getexecpath

Implement File::GetExePath() for OpenBSD with getexecpath()
This commit is contained in:
Admiral H. Curtiss
2026-10-02 19:52:29 +02:00
committed by GitHub
2 changed files with 10 additions and 0 deletions

View File

@@ -80,6 +80,11 @@ if(HAVE_ELF_AUX_INFO)
add_definitions(-DHAVE_ELF_AUX_INFO)
endif()
check_symbol_exists(getexecpath unistd.h HAVE_GETEXECPATH)
if(HAVE_GETEXECPATH)
add_definitions(-DHAVE_GETEXECPATH)
endif()
add_subdirectory(Core)
if (ANDROID)
add_subdirectory(Android/jni)

View File

@@ -740,6 +740,11 @@ std::string GetExePath()
if (sysctl(name, 4, dolphin_exe_path.data(), &length, nullptr, 0) != 0)
return {};
return dolphin_exe_path;
#elif defined(__OpenBSD__) && defined(HAVE_GETEXECPATH)
char dolphin_exe_path[PATH_MAX];
if (getexecpath(dolphin_exe_path, sizeof(dolphin_exe_path)) != 0)
return {};
return dolphin_exe_path;
#else
char dolphin_exe_path[PATH_MAX];
ssize_t len = ::readlink("/proc/self/exe", dolphin_exe_path, sizeof(dolphin_exe_path));