From 9240ab2dbe3b34d762f7f05306786ac52f133618 Mon Sep 17 00:00:00 2001 From: LaGrunge Date: Mon, 14 Oct 2019 15:31:48 +0300 Subject: [PATCH] mac test tryfix --- platform/platform.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/platform/platform.cpp b/platform/platform.cpp index 6c9459d..2b784b4 100644 --- a/platform/platform.cpp +++ b/platform/platform.cpp @@ -22,6 +22,11 @@ #include "platform/constants.hpp" + +#ifdef GEOCORE_OS_MAC +#include +#endif + namespace fs = boost::filesystem; using namespace std; @@ -374,8 +379,14 @@ namespace bool GetBinaryDir(string & outPath) { char path[4096] = {}; +#ifdef GEOCORE_OS_MAC + uint32_t size = 4096; + if (_NSGetExecutablePath(path, &size) != 0) + return false; +#else if (::readlink("/proc/self/exe", path, ARRAY_SIZE(path)) <= 0) return false; +#endif outPath = path; outPath.erase(outPath.find_last_of('/') + 1); return true;