| 922 | } |
| 923 | |
| 924 | static bool resolve_self_executable(char *out, size_t outsz) { |
| 925 | #if defined(__APPLE__) |
| 926 | char buf[1024]; |
| 927 | uint32_t sz = sizeof(buf); |
| 928 | if (_NSGetExecutablePath(buf, &sz) == 0 && buf[0]) { |
| 929 | return copy_path(out, outsz, buf); |
| 930 | } |
| 931 | return false; |
| 932 | #else |
| 933 | char buf[1024]; |
| 934 | ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf) - 1); |
| 935 | if (len > 0) { |
| 936 | buf[len] = '\0'; |
| 937 | return copy_path(out, outsz, buf); |
| 938 | } |
| 939 | return false; |
| 940 | #endif |
| 941 | } |
| 942 | #else |
| 943 | static bool resolve_self_executable(char *out, size_t outsz) { |
| 944 | char *utf8 = cbm_module_path_utf8(); |
no test coverage detected