From: Brendan Shanks bshanks@codeweavers.com
--- loader/main.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/loader/main.c b/loader/main.c index 3467d29cb5c..f8b113f3136 100644 --- a/loader/main.c +++ b/loader/main.c @@ -34,6 +34,9 @@ #ifdef HAVE_SYS_SYSCTL_H # include <sys/sysctl.h> #endif +#ifdef __APPLE__ +# include <mach-o/dyld.h> +#endif
#include "main.h"
@@ -134,6 +137,12 @@ static const char *get_self_exe(void) if (path && !sysctl( pathname, sizeof(pathname)/sizeof(pathname[0]), path, &path_size, NULL, 0 )) return path; free( path ); +#elif defined(__APPLE__) + uint32_t path_size = PATH_MAX; + char *path = malloc( path_size ); + if (path && !_NSGetExecutablePath( path, &path_size )) + return path; + free( path ); #endif return NULL; }