Skip to content

Commit

Permalink
SporeModManager: show error when reading /proc/self/exe fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Oct 27, 2023
1 parent ebb3018 commit 192ac11
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions SporeModManager/SporeModManagerHelpers/Path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ std::filesystem::path Path::GetCurrentExecutablePath(void)
}

if (GetModuleFileNameW(nullptr, currentExecutablePathBuf, MAX_PATH) == 0)
{
{ // fallback to current path
std::cerr << "GetModuleFileNameW() Failed!" << std::endl;
return currentExecutablePath;
return std::filesystem::current_path();
}

currentExecutablePath = currentExecutablePathBuf;
Expand All @@ -137,7 +137,8 @@ std::filesystem::path Path::GetCurrentExecutablePath(void)
return std::filesystem::canonical("/proc/self/exe").parent_path();
}
catch (...)
{ // fail silently and fallback to current path
{ // fallback to current path
std::cerr << "std::filesystem::canonical(\"/proc/self/exe\") Failed!" << std::endl;
return std::filesystem::current_path();
}
#endif // _WIN32
Expand Down

0 comments on commit 192ac11

Please sign in to comment.