diff --git a/loader/include/Geode/utils/VersionInfo.hpp b/loader/include/Geode/utils/VersionInfo.hpp index 2744300b..f94472ca 100644 --- a/loader/include/Geode/utils/VersionInfo.hpp +++ b/loader/include/Geode/utils/VersionInfo.hpp @@ -121,12 +121,15 @@ namespace geode { if (m_version.getMajor() != version.getMajor()) { return false; } + switch (m_compare) { - case VersionCompare::Exact: return m_version == version; break; - case VersionCompare::LessEq: return m_version <= version; break; - case VersionCompare::MoreEq: return m_version >= version; break; + case VersionCompare::LessEq: + return m_version <= version; + case VersionCompare::MoreEq: + return m_version >= version; + default: + return m_version == version; } - return false; } std::string toString() const; diff --git a/loader/src/utils/VersionInfo.cpp b/loader/src/utils/VersionInfo.cpp index f0abafc3..13f8aad7 100644 --- a/loader/src/utils/VersionInfo.cpp +++ b/loader/src/utils/VersionInfo.cpp @@ -115,15 +115,16 @@ Result ComparableVersionInfo::parse(std::string const& ra if (string.starts_with("<=")) { compare = VersionCompare::LessEq; string.erase(0, 2); - } - else if (string.starts_with(">=")) { + } else if (string.starts_with(">=")) { compare = VersionCompare::MoreEq; string.erase(0, 2); - } - else if (string.starts_with("=")) { + } else if (string.starts_with("=")) { compare = VersionCompare::Exact; string.erase(0, 1); + } else { + compare = VersionCompare::MoreEq; } + GEODE_UNWRAP_INTO(auto version, VersionInfo::parse(string)); return Ok(ComparableVersionInfo(version, compare)); }