diff --git a/README.md b/README.md index e168b5250..129063604 100644 --- a/README.md +++ b/README.md @@ -58,11 +58,11 @@ cmake --build . --config RelWithDebInfo ## Building on Mac -If you install conan via brew you must ensure you get the correct version; however, the cmake-conan script will not detect it from the default install location. You must therefore also alias it elsewhere: +If you install conan via brew the cmake-conan script will not detect it from the default install location. You must therefore also alias it elsewhere: ```bash -brew install conan@1 -sudo ln -s /usr/local/opt/conan@1/bin/conan /usr/local/bin/conan +brew install conan +sudo ln -s /usr/local/opt/conan/bin/conan /usr/local/bin/conan cd open.mp mkdir build cd build diff --git a/Server/Source/util.hpp b/Server/Source/util.hpp index 0491a3e2d..4f18255fd 100644 --- a/Server/Source/util.hpp +++ b/Server/Source/util.hpp @@ -31,6 +31,9 @@ static LARGE_INTEGER yo; #include #include #include +#ifdef __APPLE__ +#include +#endif #define SET_TICKER_RESOLUTION(ms) #define LIBRARY_OPEN(path) dlopen(path, RTLD_LAZY | RTLD_LOCAL) #define LIBRARY_OPEN_GLOBAL(path) dlopen(path, RTLD_LAZY | RTLD_GLOBAL) @@ -153,6 +156,19 @@ ghc::filesystem::path GetExecutablePath() { return ghc::filesystem::path(); } +#elif defined(__APPLE__) + char path[4096] = { 0 }; + uint32_t size = sizeof(path); + if (_NSGetExecutablePath(path, &size) == 0) + { + std::error_code ec; + auto canonicalPath = ghc::filesystem::canonical(path, ec); + return ec ? ghc::filesystem::path(path) : canonicalPath; + } + else + { + return ghc::filesystem::path(); + } #else return ghc::filesystem::canonical("/proc/self/exe"); #endif