From 57cfbc0ceaa7b44851e159d9007e36c574721cf0 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 5 Jan 2022 09:23:48 +0100 Subject: [PATCH] Fix find_ivl_root for OSX --- driver/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/driver/main.c b/driver/main.c index bce403197..52f064e51 100644 --- a/driver/main.c +++ b/driver/main.c @@ -1044,7 +1044,7 @@ static void find_ivl_root(void) if the user has overridden $(bindir) or $(libdir), but there's not a lot we can do in that case. */ -#ifdef __MINGW32__ +#if defined(__MINGW32__) char tmppath[MAXSIZE]; len = GetModuleFileName(NULL, tmppath, sizeof tmppath); if (len >= (ssize_t) sizeof ivl_root) { @@ -1052,6 +1052,9 @@ static void find_ivl_root(void) } /* Convert to a short name to remove any embedded spaces. */ len = GetShortPathName(tmppath, ivl_root, sizeof ivl_root); +#elif defined(__APPLE__) + uint32_t size = sizeof ivl_root; + len = _NSGetExecutablePath(ivl_root, &size) + 1; #else len = readlink("/proc/self/exe", ivl_root, sizeof ivl_root); #endif