make >= default prevent issues

This commit is contained in:
camila314 2023-02-09 09:45:06 -06:00
parent 1f7d50a9b9
commit 41aef57758
2 changed files with 12 additions and 8 deletions

View file

@ -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;

View file

@ -115,15 +115,16 @@ Result<ComparableVersionInfo> 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));
}