From e72d28c243294fbbcc063218234adb8ad4e0a9bf Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Mon, 27 Sep 2021 15:19:16 +0200 Subject: [PATCH] Fix base path in linux --- make/makefile | 2 +- oscar64/oscar64.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/make/makefile b/make/makefile index a1cf3c4..4e1b0a2 100644 --- a/make/makefile +++ b/make/makefile @@ -35,7 +35,7 @@ endif .PHONY : clean clean : - -rm *.o *.d oscar64 + -rm *.o *.d ../bin/oscar64 ifeq ($(UNAME_S), Darwin) diff --git a/oscar64/oscar64.cpp b/oscar64/oscar64.cpp index 22f7523..78a178e 100644 --- a/oscar64/oscar64.cpp +++ b/oscar64/oscar64.cpp @@ -1,6 +1,8 @@ #include #ifdef _WIN32 #include +#else +#include #endif #include "Compiler.h" @@ -69,8 +71,10 @@ int main(int argc, const char** argv) DWORD length = ::GetModuleFileNameA(NULL, basePath, sizeof(basePath)); #else - strcpy(basePath, argv[0]); - int length = strlen(basePath); + int length = readlink("/proc/self/exe", basePath, sizeof(basePath)); + +// strcpy(basePath, argv[0]); +// int length = strlen(basePath); #endif while (length > 0 && basePath[length - 1] != '/' && basePath[length - 1] != '\\') length--;