diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2026-10-02 19:52:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-02 19:52:29 +0200 |
| commit | 061f3e95bbe925bc52e1b491e586dcf039481d61 (patch) | |
| tree | 420d8a74f481a176d6a90bc26b08fda344744270 /Source | |
| parent | 8e7521c46eb674119038c9a5e19f103be0251ac8 (diff) | |
| parent | 71165c82a56292cdb5f2c78b4e8bfb46d8dadb02 (diff) | |
Merge pull request #14863 from brad0/openbsd_getexecpath
Implement File::GetExePath() for OpenBSD with getexecpath()
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | Source/Core/Common/FileUtil.cpp | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 5a65524555..140abb02d7 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -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) diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 053614f31f..ba52f63094 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -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)); |
