From 3f2b3111ceac4ae7cde8b0ee7d9e0c685d7aabe2 Mon Sep 17 00:00:00 2001 From: Ilya Orlov Date: Sun, 7 Oct 2018 11:22:37 +0300 Subject: [PATCH] xrCore: implement getting work and app path on linux --- src/xrCore/xrCore.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/xrCore/xrCore.cpp b/src/xrCore/xrCore.cpp index f17aae2c293..0f6c923561c 100644 --- a/src/xrCore/xrCore.cpp +++ b/src/xrCore/xrCore.cpp @@ -203,14 +203,16 @@ void xrCore::Initialize(pcstr _ApplicationName, pcstr commandLine, LogCallback c CoInitializeEx(nullptr, COINIT_MULTITHREADED); #endif +#if defined(WINDOWS) string_path fn, dr, di; // application path -#if defined(WINDOWS) GetModuleFileName(GetModuleHandle("xrCore"), fn, sizeof(fn)); -#endif _splitpath(fn, dr, di, nullptr, nullptr); strconcat(sizeof(ApplicationPath), ApplicationPath, dr, di); +#else + SDL_strlcpy(ApplicationPath, SDL_GetBasePath(), sizeof(ApplicationPath)); +#endif #ifdef _EDITOR // working path @@ -222,7 +224,11 @@ void xrCore::Initialize(pcstr _ApplicationName, pcstr commandLine, LogCallback c } #endif - SDL_strlcpy(WorkingPath, SDL_GetBasePath(), sizeof(WorkingPath)); +#if defined(WINDOWS) + GetCurrentDirectory(sizeof(WorkingPath), WorkingPath); +#else + getcwd(WorkingPath, sizeof(WorkingPath)); +#endif #if defined(WINDOWS) // User/Comp Name