mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 20:31:41 +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
|
#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[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
timeBeginPeriod(1);
|
timeBeginPeriod(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SetWorkingDirectoryToExecutable();
|
||||||
|
|
||||||
os::process::CheckConsole();
|
os::process::CheckConsole();
|
||||||
|
|
||||||
if (!os::registry::Init())
|
if (!os::registry::Init())
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue