mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 21:01:37 +00:00
switch to pre-existing implementations of getting the executable path
This commit is contained in:
parent
bb2947dd29
commit
2f8852137c
1 changed files with 2 additions and 17 deletions
|
|
@ -180,29 +180,14 @@ void init()
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetWorkingDirectoryToExecutable()
|
|
||||||
{
|
|
||||||
std::filesystem::path exePath;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
wchar_t path[MAX_PATH];
|
|
||||||
GetModuleFileNameW(NULL, path, sizeof(path));
|
|
||||||
|
|
||||||
exePath = path;
|
|
||||||
#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();
|
// Set the current working directory to the executable's path.
|
||||||
|
std::filesystem::current_path(os::process::GetExecutablePath().parent_path());
|
||||||
|
|
||||||
os::process::CheckConsole();
|
os::process::CheckConsole();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue