Handle exename on macos (#4071)
This commit is contained in:
parent
449d351095
commit
6f597091a4
11
cli/main.cpp
11
cli/main.cpp
|
@ -76,6 +76,12 @@
|
|||
static char exename[1024] = {0};
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <mach-o/dyld.h>
|
||||
|
||||
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 {
|
||||
|
|
Loading…
Reference in New Issue