diff --git a/bindings/Cocos2d.bro b/bindings/Cocos2d.bro index 30a9b887..1801d8ff 100644 --- a/bindings/Cocos2d.bro +++ b/bindings/Cocos2d.bro @@ -659,6 +659,7 @@ class cocos2d::CCRenderTexture { auto end() = mac 0x35d2c0; static cocos2d::CCRenderTexture* create(int, int, cocos2d::CCTexture2DPixelFormat) = mac 0x35c720; auto newCCImage(bool) = mac 0x35d7d0; + auto saveToFile(char const*) = mac 0x35dab0; } class cocos2d::CCRepeat { diff --git a/loader/include/Geode/loader/Loader.hpp b/loader/include/Geode/loader/Loader.hpp index eddce8ef..cc764d79 100644 --- a/loader/include/Geode/loader/Loader.hpp +++ b/loader/include/Geode/loader/Loader.hpp @@ -23,6 +23,7 @@ namespace geode { static constexpr std::string_view GEODE_CONFIG_DIRECTORY = "config"; static constexpr std::string_view GEODE_TEMP_DIRECTORY = "temp"; static constexpr std::string_view GEODE_MOD_EXTENSION = ".geode"; + static constexpr std::string_view GEODE_INDEX_DIRECTORY = "index"; class Mod; class Hook; diff --git a/loader/src/index/Index.cpp b/loader/src/index/Index.cpp index 5b6c22f1..9f379960 100644 --- a/loader/src/index/Index.cpp +++ b/loader/src/index/Index.cpp @@ -87,7 +87,7 @@ void Index::updateIndex(IndexUpdateCallback callback, bool force) { // create directory for the local clone of // the index - auto indexDir = Loader::get()->getGeodeDirectory() / "index"; + auto indexDir = Loader::get()->getGeodeSaveDirectory() / GEODE_INDEX_DIRECTORY; ghc::filesystem::create_directories(indexDir); #if GITHUB_DONT_RATE_LIMIT_ME_PLS == 1 @@ -121,7 +121,7 @@ void Index::updateIndex(IndexUpdateCallback callback, bool force) { .fetch("https://api.github.com/repos/geode-sdk/mods/commits/main") .text() .then([this, force, callback, currentCommitSHA](std::string const& upcomingCommitSHA) { - auto indexDir = Loader::get()->getGeodeDirectory() / "index"; + auto indexDir = Loader::get()->getGeodeSaveDirectory() / GEODE_INDEX_DIRECTORY; // gee i sure hope no one does 60 commits to the mod index an hour and download every // single one of them @@ -278,7 +278,7 @@ void Index::addIndexItemFromFolder(ghc::filesystem::path const& dir) { Result<> Index::updateIndexFromLocalCache() { m_items.clear(); - auto baseIndexDir = Loader::get()->getGeodeDirectory() / "index"; + auto baseIndexDir = Loader::get()->getGeodeSaveDirectory() / GEODE_INDEX_DIRECTORY; // load geode.json (index settings) if (auto baseIndexJson = readJSON(baseIndexDir / "geode.json")) { @@ -523,7 +523,7 @@ void InstallItems::error(std::string const& info) { void InstallItems::finish(bool replaceFiles) { // move files from temp dir to geode directory - auto tempDir = Loader::get()->getGeodeDirectory() / "index" / "temp"; + auto tempDir = Loader::get()->getGeodeSaveDirectory() / GEODE_INDEX_DIRECTORY / "temp"; for (auto& file : ghc::filesystem::directory_iterator(tempDir)) { try { auto modDir = Loader::get()->getGeodeDirectory() / "mods"; @@ -599,7 +599,7 @@ InstallItems::CallbackID InstallItems::start(ItemInstallCallback callback, bool // by virtue of running this function we know item must be valid auto item = Index::get()->getKnownItem(inst); - auto indexDir = Loader::get()->getGeodeDirectory() / "index"; + auto indexDir = Loader::get()->getGeodeSaveDirectory() / GEODE_INDEX_DIRECTORY; (void)file::createDirectoryAll(indexDir / "temp"); auto tempFile = indexDir / "temp" / item.m_download.m_filename; diff --git a/loader/src/load/Loader.cpp b/loader/src/load/Loader.cpp index e22df0b0..7ca27849 100644 --- a/loader/src/load/Loader.cpp +++ b/loader/src/load/Loader.cpp @@ -37,6 +37,10 @@ void Loader::createDirectories() { auto tempDir = this->getGeodeDirectory() / GEODE_TEMP_DIRECTORY; auto confDir = this->getGeodeDirectory() / GEODE_CONFIG_DIRECTORY; + #ifdef GEODE_IS_MACOS + ghc::filesystem::create_directory(this->getSaveDirectory()); + #endif + ghc::filesystem::create_directories(resDir); ghc::filesystem::create_directory(confDir); ghc::filesystem::create_directory(modDir); @@ -423,7 +427,12 @@ ghc::filesystem::path Loader::getGameDirectory() const { } ghc::filesystem::path Loader::getSaveDirectory() const { + // not using ~/Library/Caches + #ifdef GEODE_IS_MACOS + return ghc::filesystem::path("/Users/Shared/Geode"); + #else return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath().c_str()); + #endif } ghc::filesystem::path Loader::getGeodeDirectory() const {