| ... | ... | @@ -45,6 +45,7 @@ typedef SSIZE_T ssize_t; |
| 45 | 45 | #if defined(__MACH__) |
| 46 | 46 | #include <mach/clock.h> |
| 47 | 47 | #include <mach/mach.h> |
| 48 | #include <mach-o/dyld.h> |
| 48 | 49 | #endif |
| 49 | 50 | |
| 50 | 51 | #if defined(ZIG_OS_WINDOWS) |
| ... | ... | @@ -923,7 +924,13 @@ int os_self_exe_path(Buf *out_path) { |
| 923 | 924 | } |
| 924 | 925 | |
| 925 | 926 | #elif defined(ZIG_OS_DARWIN) |
| 926 | | return ErrorFileNotFound; |
| 927 | uint32_t u32_len = 0; |
| 928 | int ret1 = _NSGetExecutablePath(nullptr, &u32_len); |
| 929 | assert(ret1 != 0); |
| 930 | buf_resize(out_path, u32_len); |
| 931 | int ret2 = _NSGetExecutablePath(buf_ptr(out_path), &u32_len); |
| 932 | assert(ret2 == 0); |
| 933 | return 0; |
| 927 | 934 | #elif defined(ZIG_OS_LINUX) |
| 928 | 935 | buf_resize(out_path, 256); |
| 929 | 936 | for (;;) { |