From fd363d7d851e3eae752a8650b5b0471968fa3f73 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 2 Mar 2020 13:47:34 +0100 Subject: [PATCH] Implement getexecname() for osx. --- libbacktrace/fileline.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libbacktrace/fileline.cpp b/libbacktrace/fileline.cpp index 3c3103d1..7b3dbfbf 100644 --- a/libbacktrace/fileline.cpp +++ b/libbacktrace/fileline.cpp @@ -47,7 +47,24 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "internal.hpp" #ifndef HAVE_GETEXECNAME +# ifdef __APPLE__ +# include +static const char* getexecname() +{ + static char execname[PATH_MAX+1]; + uint32_t size = sizeof( execname ); + if( _NSGetExecutablePath( execname, &size ) == 0 ) + { + return execname; + } + else + { + return nullptr; + } +} +# else #define getexecname() NULL +# endif #endif namespace tracy