Skip to content

Commit

Permalink
SporeModLoader: improve C++ ends_with() check for C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Oct 27, 2024
1 parent 733cb0c commit d427778
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion SporeModLoader/SporeModLoaderHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ std::vector<std::filesystem::path> Path::GetModLibsPaths(void)
#ifdef __cpp_lib_starts_ends_with
if (filename.ends_with(postfix))
#else // C++17
if (filename.find(postfix) != std::wstring::npos)
if (filename.size() >= postfix.size() &&
filename.find(postfix, filename.size() - postfix.size()) != std::wstring::npos)
#endif
{
skipLib = true;
Expand Down

0 comments on commit d427778

Please sign in to comment.