Skip to content

Commit

Permalink
Fix building for ios
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Sep 10, 2023
1 parent fa41d9d commit cfdae65
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/futils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,14 @@ std::string getProcessPath() {
auto path = fs::read_symlink(Internal::stringFormat("/proc/%d/path/a.out", getpid()));
#elif defined(__unix__)
auto path = fs::read_symlink("/proc/self/exe");
#elif defined(__APPLE__)
// For apple systems other than macOS, e.g. iOS.
char pathbuf[2048];
uint32_t size = sizeof(pathbuf);
const int get_exec_path_failure = _NSGetExecutablePath(pathbuf, &size);
if (get_exec_path_failure)
return "unknown"; // pathbuf not big enough
auto path = fs::path(pathbuf);
#endif
return path.parent_path().string();
} catch (const fs::filesystem_error&) {
Expand Down

0 comments on commit cfdae65

Please sign in to comment.