add Mod::getResourcesDir for getting the mod's resources directory

This commit is contained in:
HJfod 2023-02-25 11:10:36 +02:00
parent 7089194be9
commit 00550323e5
3 changed files with 15 additions and 1 deletions

View file

@ -83,7 +83,16 @@ namespace geode {
bool wasSuccesfullyLoaded() const;
ModInfo getModInfo() const;
ghc::filesystem::path getTempDir() const;
/**
* Get the path to the mod's platform binary (.dll on Windows, .dylib
* on Mac & iOS, .so on Android)
*/
ghc::filesystem::path getBinaryPath() const;
/**
* Get the path to the mod's runtime resources directory (contains all
* of its resources)
*/
ghc::filesystem::path getResourcesDir() const;
Result<> saveData();
Result<> loadData();

View file

@ -270,7 +270,7 @@ void Loader::Impl::updateModResources(Mod* mod) {
return;
}
auto searchPath = dirs::getModRuntimeDir() / mod->getID() / "resources";
auto searchPath = mod->getResourcesDir();
log::debug("Adding resources for {}", mod->getID());

View file

@ -1,4 +1,5 @@
#include <Geode/loader/Mod.hpp>
#include <Geode/loader/Dirs.hpp>
#include "ModImpl.hpp"
USE_GEODE_NAMESPACE();
@ -71,6 +72,10 @@ ghc::filesystem::path Mod::getBinaryPath() const {
return m_impl->getBinaryPath();
}
ghc::filesystem::path Mod::getResourcesDir() const {
return dirs::getModRuntimeDir() / this->getID() / "resources";
}
Result<> Mod::saveData() {
return m_impl->saveData();
}