diff --git a/cli/main.cpp b/cli/main.cpp index ca48497d2..dae782ce6 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -76,6 +76,12 @@ static char exename[1024] = {0}; #endif +#if defined(__APPLE__) +#include + +static char exename[1024] = {0}; +#endif + /** * Main function of cppcheck * @@ -95,6 +101,11 @@ int main(int argc, char* argv[]) GetModuleFileNameA(nullptr, exename, sizeof(exename)/sizeof(exename[0])-1); argv[0] = exename; #endif +#if defined(__APPLE__) + uint32_t size = sizeof(exename); + _NSGetExecutablePath(exename, &size); + argv[0] = exename; +#endif // *INDENT-OFF* #ifdef NDEBUG try {