Fix base path in linux
This commit is contained in:
parent
1755b4b89d
commit
e72d28c243
|
@ -35,7 +35,7 @@ endif
|
||||||
|
|
||||||
.PHONY : clean
|
.PHONY : clean
|
||||||
clean :
|
clean :
|
||||||
-rm *.o *.d oscar64
|
-rm *.o *.d ../bin/oscar64
|
||||||
|
|
||||||
ifeq ($(UNAME_S), Darwin)
|
ifeq ($(UNAME_S), Darwin)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
|
@ -69,8 +71,10 @@ int main(int argc, const char** argv)
|
||||||
|
|
||||||
DWORD length = ::GetModuleFileNameA(NULL, basePath, sizeof(basePath));
|
DWORD length = ::GetModuleFileNameA(NULL, basePath, sizeof(basePath));
|
||||||
#else
|
#else
|
||||||
strcpy(basePath, argv[0]);
|
int length = readlink("/proc/self/exe", basePath, sizeof(basePath));
|
||||||
int length = strlen(basePath);
|
|
||||||
|
// strcpy(basePath, argv[0]);
|
||||||
|
// int length = strlen(basePath);
|
||||||
#endif
|
#endif
|
||||||
while (length > 0 && basePath[length - 1] != '/' && basePath[length - 1] != '\\')
|
while (length > 0 && basePath[length - 1] != '/' && basePath[length - 1] != '\\')
|
||||||
length--;
|
length--;
|
||||||
|
|
Loading…
Reference in New Issue