Skip to content

Commit

Permalink
xrCore: implement getting work and app path on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleivg committed Oct 7, 2018
1 parent 622357d commit 3f2b311
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/xrCore/xrCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 3f2b311

Please sign in to comment.