Skip to content

Commit

Permalink
SporeModManager: fix Path::GetAbsolutePath() for mingw
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Jan 1, 2024
1 parent 1dd18e1 commit 67b372c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions SporeModManager/SporeModManagerHelpers/Path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ std::filesystem::path Path::GetAbsolutePath(std::filesystem::path path)
}
catch (...)
{
// mingw has weird behavior with std::filesystem::canonical(),
// it throws an exception even though the relative path exists,
// so to workaround that, we'll check if the fullPath exists and
// return that
#ifdef __MINGW32__
if (std::filesystem::is_directory(fullPath))
{
return fullPath;
}
#endif
// just return the original path,
// because the directory probably doesn't exist
return path;
Expand Down

0 comments on commit 67b372c

Please sign in to comment.