mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
Shared directory
This commit is contained in:
parent
55d974cd50
commit
9e4b236d1b
4 changed files with 16 additions and 5 deletions
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue