aboutsummaryrefslogtreecommitdiff
path: root/zencore/filesystem.cpp
diff options
context:
space:
mode:
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
}