mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-22 07:27:59 -05:00
add persistent dir
This commit is contained in:
parent
b3d54747bf
commit
68ab4750ac
6 changed files with 30 additions and 3 deletions
|
@ -56,4 +56,9 @@ namespace geode::dirs {
|
|||
* Directory where crashlogs are stored
|
||||
*/
|
||||
GEODE_DLL std::filesystem::path getCrashlogsDir();
|
||||
/**
|
||||
* Directory where mods' persistent files lie
|
||||
* This directory is not deleted even when Geode is uninstalled
|
||||
*/
|
||||
GEODE_DLL std::filesystem::path getModPersistentDir();
|
||||
}
|
||||
|
|
|
@ -172,6 +172,11 @@ namespace geode {
|
|||
* Get the mod's config directory path
|
||||
*/
|
||||
std::filesystem::path getConfigDir(bool create = true) const;
|
||||
/**
|
||||
* Get the mod's persistent directory path
|
||||
* This directory is not deleted even when Geode/mod is uninstalled
|
||||
*/
|
||||
std::filesystem::path getPersistentDir(bool create = true) const;
|
||||
|
||||
/**
|
||||
* Returns true if this mod has any settings
|
||||
|
|
|
@ -24,15 +24,15 @@ std::filesystem::path dirs::getGeodeLogDir() {
|
|||
}
|
||||
|
||||
std::filesystem::path dirs::getTempDir() {
|
||||
return getGeodeDir() / "temp";
|
||||
return dirs::getGeodeDir() / "temp";
|
||||
}
|
||||
|
||||
std::filesystem::path dirs::getModsDir() {
|
||||
return getGeodeDir() / "mods";
|
||||
return dirs::getGeodeDir() / "mods";
|
||||
}
|
||||
|
||||
std::filesystem::path dirs::getModsSaveDir() {
|
||||
return getGeodeSaveDir() / "mods";
|
||||
return dirs::getGeodeSaveDir() / "mods";
|
||||
}
|
||||
|
||||
std::filesystem::path dirs::getModConfigDir() {
|
||||
|
@ -46,3 +46,7 @@ std::filesystem::path dirs::getIndexDir() {
|
|||
std::filesystem::path dirs::getCrashlogsDir() {
|
||||
return crashlog::getCrashLogDirectory();
|
||||
}
|
||||
|
||||
std::filesystem::path dirs::getModPersistentDir() {
|
||||
return dirs::getSaveDir() / "geode-persistent";
|
||||
}
|
|
@ -143,6 +143,10 @@ std::filesystem::path Mod::getConfigDir(bool create) const {
|
|||
return m_impl->getConfigDir(create);
|
||||
}
|
||||
|
||||
std::filesystem::path Mod::getPersistentDir(bool create) const {
|
||||
return m_impl->getPersistentDir(create);
|
||||
}
|
||||
|
||||
bool Mod::hasSettings() const {
|
||||
return m_impl->hasSettings();
|
||||
}
|
||||
|
|
|
@ -656,6 +656,14 @@ std::filesystem::path Mod::Impl::getConfigDir(bool create) const {
|
|||
return dir;
|
||||
}
|
||||
|
||||
std::filesystem::path Mod::Impl::getPersistentDir(bool create) const {
|
||||
auto dir = dirs::getModPersistentDir() / m_metadata.getID();
|
||||
if (create) {
|
||||
(void)file::createDirectoryAll(dir);
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
std::string_view Mod::Impl::expandSpriteName(std::string_view name) {
|
||||
std::string nameKey(name);
|
||||
if (m_expandedSprites.contains(nameKey)) return m_expandedSprites[nameKey];
|
||||
|
|
|
@ -113,6 +113,7 @@ namespace geode {
|
|||
|
||||
std::filesystem::path getSaveDir() const;
|
||||
std::filesystem::path getConfigDir(bool create = true) const;
|
||||
std::filesystem::path getPersistentDir(bool create = true) const;
|
||||
|
||||
bool hasSettings() const;
|
||||
std::vector<std::string> getSettingKeys() const;
|
||||
|
|
Loading…
Reference in a new issue