See https://github.com/thezbyg/gpick/pull/220 --- source/Paths.cpp.orig 2022-05-08 03:20:36 +++ source/Paths.cpp 2023-05-30 19:26:04 @@ -26,6 +26,9 @@ #include #if BOOST_OS_WINDOWS != 0 #include +#elif BOOST_OS_MACOS != 0 +#include +#include #else #include #endif @@ -61,6 +64,18 @@ if (length < buffer.size()) return std::string(buffer.begin(), buffer.begin() + length); buffer.resize(buffer.size() * 2); + } +} +#elif BOOST_OS_MACOS != 0 +static std::string getExecutablePath() { + uint32_t bufsize = 4096; + std::vector buffer; + buffer.resize(bufsize); + while (1) { + int sizeOk = _NSGetExecutablePath(buffer.data(), &bufsize); + if (sizeOk==0) + return std::string(buffer.begin(), buffer.begin() + std::strlen(buffer.data())); + buffer.resize(bufsize); } } #else