diff --git a/loader/include/Geode/utils/VersionInfo.hpp b/loader/include/Geode/utils/VersionInfo.hpp index 23dc785e..eaba5a63 100644 --- a/loader/include/Geode/utils/VersionInfo.hpp +++ b/loader/include/Geode/utils/VersionInfo.hpp @@ -11,6 +11,8 @@ namespace geode { LessEq, Exact, MoreEq, + Less, + More, }; /** @@ -206,7 +208,11 @@ namespace geode { return version <= m_version; case VersionCompare::MoreEq: return version >= m_version; - default: + case VersionCompare::Less: + return version < m_version; + case VersionCompare::More: + return version > m_version; + case VersionCompare::Exact: return version == m_version; } } diff --git a/loader/include/Geode/utils/file.hpp b/loader/include/Geode/utils/file.hpp index 6438e6fa..9e932c57 100644 --- a/loader/include/Geode/utils/file.hpp +++ b/loader/include/Geode/utils/file.hpp @@ -60,8 +60,6 @@ namespace geode::utils::file { ghc::filesystem::path const& path, bool recursive = false ); - GEODE_DLL ghc::filesystem::path current_path(); - class Unzip; class GEODE_DLL Zip final { diff --git a/loader/src/loader/Dirs.cpp b/loader/src/loader/Dirs.cpp index 133f69c2..b23e558b 100644 --- a/loader/src/loader/Dirs.cpp +++ b/loader/src/loader/Dirs.cpp @@ -18,10 +18,6 @@ namespace { } } -ghc::filesystem::path dirs::getGameDir() { - return utils::file::current_path(); -} - ghc::filesystem::path dirs::getSaveDir() { #ifdef GEODE_IS_MACOS // not using ~/Library/Caches @@ -32,11 +28,7 @@ ghc::filesystem::path dirs::getSaveDir() { } ghc::filesystem::path dirs::getGeodeDir() { -#ifdef GEODE_IS_MACOS - return utils::file::current_path() / "geode"; -#else return dirs::getGameDir() / "geode"; -#endif } ghc::filesystem::path dirs::getGeodeSaveDir() { diff --git a/loader/src/main.cpp b/loader/src/main.cpp index dc2a9d71..2be8e6a0 100644 --- a/loader/src/main.cpp +++ b/loader/src/main.cpp @@ -31,7 +31,7 @@ void dynamicEntry() { auto dylib = dlopen("GeodeBootstrapper.dylib", RTLD_NOLOAD); dlclose(dylib); - auto workingDir = utils::file::current_path(); + auto workingDir = dirs::getGameDir(); auto libDir = workingDir / "Frameworks"; auto updatesDir = workingDir / "geode" / "update"; @@ -66,7 +66,7 @@ DWORD WINAPI loadThread(void* arg) { } if (canMoveBootstrapper) { - auto workingDir = utils::file::current_path(); + auto workingDir = dirs::getGameDir(); auto updatesDir = workingDir / "geode" / "update"; auto error = std::error_code(); diff --git a/loader/src/platform/ios/util.mm b/loader/src/platform/ios/util.mm index 5bf60f9a..2e1505bf 100644 --- a/loader/src/platform/ios/util.mm +++ b/loader/src/platform/ios/util.mm @@ -4,11 +4,11 @@ #ifdef GEODE_IS_IOS using namespace geode::prelude; - - #include - #include - #include - #include +#include +#include +#include +#include +#include bool utils::clipboard::write(std::string const& data) { [UIPasteboard generalPasteboard].string = [NSString stringWithUTF8String:data.c_str()]; @@ -28,7 +28,8 @@ void geode_nslog(uintptr_t x) { NSLog(@"geode %lx", x); } -ghc::filesystem::path utils::file::current_path() { + +ghc::filesystem::path dirs::getGameDir() { return ghc::filesystem::current_path(); } diff --git a/loader/src/platform/mac/util.mm b/loader/src/platform/mac/util.mm index 364186d5..c5aa3ec3 100644 --- a/loader/src/platform/mac/util.mm +++ b/loader/src/platform/mac/util.mm @@ -5,6 +5,7 @@ using namespace geode::prelude; +#include #import #include #include @@ -148,7 +149,7 @@ CCPoint cocos::getMousePos() { return ccp(mouse.x - frame.origin.x, mouse.y - frame.origin.y) * scaleFactor; } -ghc::filesystem::path utils::file::current_path() { +ghc::filesystem::path dirs::getGameDir() { std::array gddir; uint32_t out = PATH_MAX; diff --git a/loader/src/platform/windows/util.cpp b/loader/src/platform/windows/util.cpp index bd2accb0..ec2cec83 100644 --- a/loader/src/platform/windows/util.cpp +++ b/loader/src/platform/windows/util.cpp @@ -4,7 +4,7 @@ #ifdef GEODE_IS_WINDOWS using namespace geode::prelude; - +#include #include "nfdwin.hpp" #include #include @@ -115,7 +115,7 @@ CCPoint cocos::getMousePos() { return ccp(mouse.x, 1.f - mouse.y) * winSize; } -ghc::filesystem::path utils::file::current_path() { +ghc::filesystem::path dirs::getGameDir() { std::array szFileName; GetModuleFileName(NULL, szFileName.data(), MAX_PATH); diff --git a/loader/src/ui/internal/info/ModInfoPopup.cpp b/loader/src/ui/internal/info/ModInfoPopup.cpp index 6b1d79f0..57af6344 100644 --- a/loader/src/ui/internal/info/ModInfoPopup.cpp +++ b/loader/src/ui/internal/info/ModInfoPopup.cpp @@ -347,7 +347,10 @@ bool LocalModInfoPopup::init(Mod* mod, ModListLayer* list) { uninstallBtn->setPosition(-85.f, 75.f); m_buttonMenu->addChild(uninstallBtn); - auto indexItem = Index::get()->getItem(mod->getModInfo()); + auto indexItem = Index::get()->getItem( + mod->getModInfo().id(), + ComparableVersionInfo(mod->getModInfo().version(), VersionCompare::More) + ); // todo: show update button on loader that invokes the installer if (indexItem && Index::get()->isUpdateAvailable(indexItem)) { diff --git a/loader/src/utils/VersionInfo.cpp b/loader/src/utils/VersionInfo.cpp index 1b22586e..5cb514c7 100644 --- a/loader/src/utils/VersionInfo.cpp +++ b/loader/src/utils/VersionInfo.cpp @@ -136,13 +136,24 @@ 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 { + } + else if (string.starts_with("<")) { + compare = VersionCompare::Less; + string.erase(0, 1); + } + else if (string.starts_with(">")) { + compare = VersionCompare::More; + string.erase(0, 1); + } + else { compare = VersionCompare::MoreEq; } @@ -156,6 +167,8 @@ std::string ComparableVersionInfo::toString() const { case VersionCompare::Exact: prefix = "="; break; case VersionCompare::LessEq: prefix = "<="; break; case VersionCompare::MoreEq: prefix = ">="; break; + case VersionCompare::Less: prefix = "<"; break; + case VersionCompare::More: prefix = ">"; break; } return prefix + m_version.toString(); }