From e2a9cf05ac8bae16755956a018b6e358dfb052c3 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Tue, 28 Sep 2021 20:54:35 +0200 Subject: [PATCH] Add base bat call for mac os --- oscar64/oscar64.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/oscar64/oscar64.cpp b/oscar64/oscar64.cpp index a155055..3991c4d 100644 --- a/oscar64/oscar64.cpp +++ b/oscar64/oscar64.cpp @@ -70,11 +70,20 @@ int main(int argc, const char** argv) } DWORD length = ::GetModuleFileNameA(NULL, basePath, sizeof(basePath)); +#else +#ifdef __APPLE__ + uint32_t length = sizeof(basePath); + + if (_NSGetExecutablePath(basePath, &length) != 0) { + // Buffer size is too small. + return false; + } #else int length = readlink("/proc/self/exe", basePath, sizeof(basePath)); // strcpy(basePath, argv[0]); // int length = strlen(basePath); +#endif #endif while (length > 0 && basePath[length - 1] != '/' && basePath[length - 1] != '\\') length--;