Explicitly set working directory to executable directory on boot

This commit is contained in:
DeaTh-G 2025-03-19 11:08:26 +01:00
parent 824405b236
commit 51a34c98e7

View file

@ -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())