mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 04:11:36 +00:00
Explicitly set working directory to executable directory on boot
This commit is contained in:
parent
824405b236
commit
51a34c98e7
1 changed files with 15 additions and 0 deletions
|
|
@ -180,12 +180,27 @@ void init()
|
|||
#endif
|
||||
}
|
||||
|
||||
void SetWorkingDirectoryToExecutable()
|
||||
{
|
||||
std::filesystem::path exePath;
|
||||
|
||||
#ifdef _WIN32
|
||||
exePath = std::filesystem::canonical(std::filesystem::path(_pgmptr));
|
||||
#else
|
||||
exePath = std::filesystem::canonical("/proc/self/exe");
|
||||
#endif
|
||||
|
||||
std::filesystem::current_path(exePath.parent_path());
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#ifdef _WIN32
|
||||
timeBeginPeriod(1);
|
||||
#endif
|
||||
|
||||
SetWorkingDirectoryToExecutable();
|
||||
|
||||
os::process::CheckConsole();
|
||||
|
||||
if (!os::registry::Init())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue