Implement ProcessUtils::currentProcessPath() on Mac

This allows the basic updater unit test to pass.
This commit is contained in:
Robert Knight 2011-08-22 14:44:16 +01:00
parent 4d7ddc91d9
commit 8149afd091

View file

@ -19,6 +19,7 @@
#ifdef PLATFORM_MAC
#include <Security/Security.h>
#include <mach-o/dyld.h>
#endif
int ProcessUtils::runSync(const std::string& executable,
@ -293,6 +294,13 @@ std::string ProcessUtils::currentProcessPath()
std::string path = FileOps::canonicalPath("/proc/self/exe");
LOG(Info,"Current process path " + path);
return path;
#elif defined(PLATFORM_MAC)
uint32_t bufferSize = PATH_MAX;
char buffer[bufferSize];
_NSGetExecutablePath(buffer,&bufferSize);
return buffer;
#else
return std::string();
#endif
}