Fix in lib which makes mistserver compilable and usable for mac
This commit is contained in:
parent
c373136679
commit
de733c31a3
1 changed files with 9 additions and 0 deletions
|
@ -10,6 +10,9 @@
|
|||
#else
|
||||
#include <wait.h>
|
||||
#endif
|
||||
#if defined(__APPLE__)
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <iostream>
|
||||
#include <signal.h>
|
||||
|
@ -401,12 +404,18 @@ void Util::Config::addBasicConnectorOptions(JSON::Value & capabilities){
|
|||
/// Gets directory the current executable is stored in.
|
||||
std::string Util::getMyPath(){
|
||||
char mypath[500];
|
||||
#ifdef __APPLE__
|
||||
memset( mypath, 0, 500);
|
||||
unsigned int refSize = 500;
|
||||
int ret = _NSGetExecutablePath(mypath,&refSize);
|
||||
#else
|
||||
int ret = readlink("/proc/self/exe", mypath, 500);
|
||||
if (ret != -1){
|
||||
mypath[ret] = 0;
|
||||
}else{
|
||||
mypath[0] = 0;
|
||||
}
|
||||
#endif
|
||||
std::string tPath = mypath;
|
||||
size_t slash = tPath.rfind('/');
|
||||
if (slash == std::string::npos){
|
||||
|
|
Loading…
Add table
Reference in a new issue