From 2f8852137c60d5782943bd8325fa0781eefde150 Mon Sep 17 00:00:00 2001 From: DeaTh-G Date: Wed, 19 Mar 2025 13:04:39 +0100 Subject: [PATCH] switch to pre-existing implementations of getting the executable path --- UnleashedRecomp/main.cpp | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/UnleashedRecomp/main.cpp b/UnleashedRecomp/main.cpp index 4149a4e4..949e872f 100644 --- a/UnleashedRecomp/main.cpp +++ b/UnleashedRecomp/main.cpp @@ -180,29 +180,14 @@ void init() #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[]) { #ifdef _WIN32 timeBeginPeriod(1); #endif - SetWorkingDirectoryToExecutable(); + // Set the current working directory to the executable's path. + std::filesystem::current_path(os::process::GetExecutablePath().parent_path()); os::process::CheckConsole();