mirror of https://github.com/kiwix/libkiwix.git
fixed getExecutablePath() on OSX
This commit is contained in:
parent
bec68ffa13
commit
17a4c42eb3
|
@ -19,6 +19,11 @@
|
||||||
|
|
||||||
#include "pathTools.h"
|
#include "pathTools.h"
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include <mach-o/dyld.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PATH_MAX
|
#ifndef PATH_MAX
|
||||||
#define PATH_MAX 1024
|
#define PATH_MAX 1024
|
||||||
#endif
|
#endif
|
||||||
|
@ -135,6 +140,9 @@ string getExecutablePath() {
|
||||||
char binRootPath[PATH_MAX];
|
char binRootPath[PATH_MAX];
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#elif __APPLE__
|
||||||
|
uint32_t max = (uint32_t)PATH_MAX;
|
||||||
|
_NSGetExecutablePath(binRootPath, &max);
|
||||||
#else
|
#else
|
||||||
readlink("/proc/self/exe", binRootPath, PATH_MAX);
|
readlink("/proc/self/exe", binRootPath, PATH_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue