From 96748d9a58265b9a1269fbb4044f0bfec2e16240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Fri, 30 Jun 2023 18:39:53 -0700 Subject: [PATCH] macOS/FilePath executable file path. --- src/filepath.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/filepath.cpp b/src/filepath.cpp index 87d355a..db8746c 100644 --- a/src/filepath.cpp +++ b/src/filepath.cpp @@ -18,6 +18,8 @@ #if BX_PLATFORM_WINDOWS extern "C" __declspec(dllimport) unsigned long __stdcall GetModuleFileNameA(void* _module, char* _outFilePath, unsigned long _size); extern "C" __declspec(dllimport) unsigned long __stdcall GetTempPathA(unsigned long _max, char* _outFilePath); +#elif BX_PLATFORM_OSX +extern "C" int _NSGetExecutablePath(char* _buf, uint32_t* _bufSize); #endif // BX_PLATFORM_WINDOWS namespace bx @@ -214,6 +216,12 @@ namespace bx return true; } #elif BX_PLATFORM_OSX + uint32_t len = *_inOutSize; + bool result = _NSGetExecutablePath(_out, &len); + if (0 == result) + { + return true; + } #endif // BX_PLATFORM_* return false;