Skip to content

Commit 3f2b311

Browse files
committed
xrCore: implement getting work and app path on linux
1 parent 622357d commit 3f2b311

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/xrCore/xrCore.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,14 +203,16 @@ void xrCore::Initialize(pcstr _ApplicationName, pcstr commandLine, LogCallback c
203203
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
204204
#endif
205205

206+
#if defined(WINDOWS)
206207
string_path fn, dr, di;
207208

208209
// application path
209-
#if defined(WINDOWS)
210210
GetModuleFileName(GetModuleHandle("xrCore"), fn, sizeof(fn));
211-
#endif
212211
_splitpath(fn, dr, di, nullptr, nullptr);
213212
strconcat(sizeof(ApplicationPath), ApplicationPath, dr, di);
213+
#else
214+
SDL_strlcpy(ApplicationPath, SDL_GetBasePath(), sizeof(ApplicationPath));
215+
#endif
214216

215217
#ifdef _EDITOR
216218
// working path
@@ -222,7 +224,11 @@ void xrCore::Initialize(pcstr _ApplicationName, pcstr commandLine, LogCallback c
222224
}
223225
#endif
224226

225-
SDL_strlcpy(WorkingPath, SDL_GetBasePath(), sizeof(WorkingPath));
227+
#if defined(WINDOWS)
228+
GetCurrentDirectory(sizeof(WorkingPath), WorkingPath);
229+
#else
230+
getcwd(WorkingPath, sizeof(WorkingPath));
231+
#endif
226232

227233
#if defined(WINDOWS)
228234
// User/Comp Name

0 commit comments

Comments
 (0)