aboutsummaryrefslogtreecommitdiff
path: root/zencore/filesystem.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-12-16 13:37:27 +0100
committerMartin Ridgers <[email protected]>2022-01-05 09:34:12 +0100
commit93397b94ae9910427bbb89d6200002ac08580bf1 (patch)
tree461cdc253b486dc9107c57f06d89d8e5776343d2 /zencore/filesystem.cpp
parentRemoved unused include statement (diff)
downloadzen-93397b94ae9910427bbb89d6200002ac08580bf1.tar.xz
zen-93397b94ae9910427bbb89d6200002ac08580bf1.zip
GetRunningExecutablePath() implementation for Mac
Diffstat (limited to 'zencore/filesystem.cpp')
-rw-r--r--zencore/filesystem.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp
index a15a7583d..1977e4293 100644
--- a/zencore/filesystem.cpp
+++ b/zencore/filesystem.cpp
@@ -30,6 +30,7 @@
#if ZEN_PLATFORM_MAC
# include <dirent.h>
# include <fcntl.h>
+# include <libproc.h>
# include <sys/stat.h>
# include <unistd.h>
#endif
@@ -960,8 +961,14 @@ GetRunningExecutablePath()
Link[BytesRead] = '\0';
return Link;
-#else
-# error Unimplemented platform
+#elif ZEN_PLATFORM_MAC
+ char Buffer[PROC_PIDPATHINFO_MAXSIZE];
+
+ int SelfPid = GetCurrentProcessId();
+ if (proc_pidpath(SelfPid, Buffer, sizeof(Buffer)) <= 0)
+ return {};
+
+ return Buffer;
#endif // ZEN_PLATFORM_WINDOWS
}