mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 09:27:57 -05:00
move directories away from loader into new dirs namespace
This commit is contained in:
parent
8126175eaa
commit
f73d1042a3
17 changed files with 739 additions and 809 deletions
|
@ -6,5 +6,6 @@
|
||||||
#include "loader/Mod.hpp"
|
#include "loader/Mod.hpp"
|
||||||
#include "loader/Setting.hpp"
|
#include "loader/Setting.hpp"
|
||||||
#include "loader/SettingEvent.hpp"
|
#include "loader/SettingEvent.hpp"
|
||||||
|
#include "loader/Dirs.hpp"
|
||||||
|
|
||||||
#include <Geode/DefaultInclude.hpp>
|
#include <Geode/DefaultInclude.hpp>
|
||||||
|
|
|
@ -83,23 +83,5 @@ namespace geode {
|
||||||
static void closePlatfromConsole();
|
static void closePlatfromConsole();
|
||||||
|
|
||||||
bool didLastLaunchCrash() const;
|
bool didLastLaunchCrash() const;
|
||||||
ghc::filesystem::path getCrashLogDirectory() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Directory where Geometry Dash is
|
|
||||||
*/
|
|
||||||
ghc::filesystem::path getGameDirectory() const;
|
|
||||||
/**
|
|
||||||
* Directory where GD saves its files
|
|
||||||
*/
|
|
||||||
ghc::filesystem::path getSaveDirectory() const;
|
|
||||||
/**
|
|
||||||
* Directory where Geode is
|
|
||||||
*/
|
|
||||||
ghc::filesystem::path getGeodeDirectory() const;
|
|
||||||
/**
|
|
||||||
* Directory where Geode saves its files
|
|
||||||
*/
|
|
||||||
ghc::filesystem::path getGeodeSaveDirectory() const;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,9 +129,6 @@ namespace geode {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Mod;
|
|
||||||
class Setting;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents if a mod has been loaded &
|
* Represents if a mod has been loaded &
|
||||||
* its dependencies resolved
|
* its dependencies resolved
|
||||||
|
@ -151,16 +148,10 @@ namespace geode {
|
||||||
Disabled,
|
Disabled,
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr std::string_view GEODE_DIRECTORY = "geode";
|
constexpr std::string_view GEODE_MOD_EXTENSION = ".geode";
|
||||||
static constexpr std::string_view GEODE_MOD_DIRECTORY = "mods";
|
|
||||||
static constexpr std::string_view GEODE_LOG_DIRECTORY = "log";
|
|
||||||
static constexpr std::string_view GEODE_RESOURCE_DIRECTORY = "resources";
|
|
||||||
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 Mod;
|
||||||
|
class Setting;
|
||||||
class Loader;
|
class Loader;
|
||||||
class Hook;
|
class Hook;
|
||||||
struct ModInfo;
|
struct ModInfo;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <Geode/loader/Loader.hpp>
|
#include <Geode/loader/Loader.hpp>
|
||||||
#include <Geode/loader/Log.hpp>
|
#include <Geode/loader/Log.hpp>
|
||||||
|
#include <Geode/loader/Dirs.hpp>
|
||||||
#include <Geode/utils/web.hpp>
|
#include <Geode/utils/web.hpp>
|
||||||
#include <Geode/utils/file.hpp>
|
#include <Geode/utils/file.hpp>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
@ -94,9 +95,8 @@ void InternalLoader::loadInfoAlerts(nlohmann::json& json) {
|
||||||
|
|
||||||
void InternalLoader::downloadLoaderResources(IndexUpdateCallback callback) {
|
void InternalLoader::downloadLoaderResources(IndexUpdateCallback callback) {
|
||||||
auto version = this->getVersion().toString();
|
auto version = this->getVersion().toString();
|
||||||
auto tempResourcesZip = this->getGeodeDirectory() / GEODE_RESOURCE_DIRECTORY / "new.zip";
|
auto tempResourcesZip = dirs::getTempDir() / "new.zip";
|
||||||
auto resourcesDir =
|
auto resourcesDir = dirs::getGeodeResourcesDir() / InternalMod::get()->getID();
|
||||||
this->getGeodeDirectory() / GEODE_RESOURCE_DIRECTORY / InternalMod::get()->getID();
|
|
||||||
|
|
||||||
web::AsyncWebRequest()
|
web::AsyncWebRequest()
|
||||||
.join("update-geode-loader-resources")
|
.join("update-geode-loader-resources")
|
||||||
|
@ -142,8 +142,7 @@ bool InternalLoader::verifyLoaderResources(IndexUpdateCallback callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// geode/resources/geode.loader
|
// geode/resources/geode.loader
|
||||||
auto resourcesDir =
|
auto resourcesDir = dirs::getGeodeResourcesDir() / InternalMod::get()->getID();
|
||||||
this->getGeodeDirectory() / GEODE_RESOURCE_DIRECTORY / InternalMod::get()->getID();
|
|
||||||
|
|
||||||
// if the resources dir doesn't exist, then it's probably incorrect
|
// if the resources dir doesn't exist, then it's probably incorrect
|
||||||
if (!(ghc::filesystem::exists(resourcesDir) && ghc::filesystem::is_directory(resourcesDir))) {
|
if (!(ghc::filesystem::exists(resourcesDir) && ghc::filesystem::is_directory(resourcesDir))) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "InternalMod.hpp"
|
#include "InternalMod.hpp"
|
||||||
|
#include <Geode/loader/Dirs.hpp>
|
||||||
#include "InternalLoader.hpp"
|
#include "InternalLoader.hpp"
|
||||||
#include "about.hpp"
|
#include "about.hpp"
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ static ModInfo getInternalModInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
InternalMod::InternalMod() : Mod(getInternalModInfo()) {
|
InternalMod::InternalMod() : Mod(getInternalModInfo()) {
|
||||||
m_saveDirPath = Loader::get()->getGeodeSaveDirectory() / GEODE_MOD_DIRECTORY / m_info.m_id;
|
m_saveDirPath = dirs::getModsSaveDir() / m_info.m_id;
|
||||||
|
|
||||||
ghc::filesystem::create_directories(m_saveDirPath);
|
ghc::filesystem::create_directories(m_saveDirPath);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Geode/DefaultInclude.hpp>
|
#include <Geode/DefaultInclude.hpp>
|
||||||
|
#include <fs/filesystem.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,5 +23,5 @@ namespace crashlog {
|
||||||
* @returns Path to the directory, or an empty string if the platform does
|
* @returns Path to the directory, or an empty string if the platform does
|
||||||
* not support crash logs
|
* not support crash logs
|
||||||
*/
|
*/
|
||||||
std::string GEODE_DLL getCrashLogDirectory();
|
ghc::filesystem::path GEODE_DLL getCrashLogDirectory();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
#include <Geode/loader/Loader.hpp>
|
#include <Geode/loader/Loader.hpp>
|
||||||
#include <Geode/loader/Mod.hpp>
|
#include <Geode/loader/Mod.hpp>
|
||||||
|
#include <Geode/loader/Dirs.hpp>
|
||||||
#include <InternalLoader.hpp>
|
#include <InternalLoader.hpp>
|
||||||
#include <InternalMod.hpp>
|
#include <InternalMod.hpp>
|
||||||
#include <about.hpp>
|
#include <about.hpp>
|
||||||
|
@ -20,9 +21,8 @@ Loader::~Loader() {
|
||||||
}
|
}
|
||||||
m_mods.clear();
|
m_mods.clear();
|
||||||
log::Logs::clear();
|
log::Logs::clear();
|
||||||
ghc::filesystem::remove_all(
|
ghc::filesystem::remove_all(dirs::getModRuntimeDir());
|
||||||
this->getGeodeDirectory() / GEODE_TEMP_DIRECTORY
|
ghc::filesystem::remove_all(dirs::getTempDir());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VersionInfo Loader::getVersion() {
|
VersionInfo Loader::getVersion() {
|
||||||
|
@ -49,24 +49,19 @@ bool Loader::isModVersionSupported(VersionInfo const& version) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loader::createDirectories() {
|
void Loader::createDirectories() {
|
||||||
auto modDir = this->getGeodeDirectory() / GEODE_MOD_DIRECTORY;
|
|
||||||
auto logDir = this->getGeodeDirectory() / GEODE_LOG_DIRECTORY;
|
|
||||||
auto resDir = this->getGeodeDirectory() / GEODE_RESOURCE_DIRECTORY;
|
|
||||||
auto tempDir = this->getGeodeDirectory() / GEODE_TEMP_DIRECTORY;
|
|
||||||
auto confDir = this->getGeodeDirectory() / GEODE_CONFIG_DIRECTORY;
|
|
||||||
|
|
||||||
#ifdef GEODE_IS_MACOS
|
#ifdef GEODE_IS_MACOS
|
||||||
ghc::filesystem::create_directory(this->getSaveDirectory());
|
ghc::filesystem::create_directory(dirs::getSaveDir());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ghc::filesystem::create_directories(resDir);
|
ghc::filesystem::create_directories(dirs::getGeodeResourcesDir());
|
||||||
ghc::filesystem::create_directory(confDir);
|
ghc::filesystem::create_directory(dirs::getModConfigDir());
|
||||||
ghc::filesystem::create_directory(modDir);
|
ghc::filesystem::create_directory(dirs::getModsDir());
|
||||||
ghc::filesystem::create_directory(logDir);
|
ghc::filesystem::create_directory(dirs::getGeodeLogDir());
|
||||||
ghc::filesystem::create_directory(tempDir);
|
ghc::filesystem::create_directory(dirs::getTempDir());
|
||||||
|
ghc::filesystem::create_directory(dirs::getModRuntimeDir());
|
||||||
|
|
||||||
if (!ranges::contains(m_modSearchDirectories, modDir)) {
|
if (!ranges::contains(m_modSearchDirectories, dirs::getModsDir())) {
|
||||||
m_modSearchDirectories.push_back(modDir);
|
m_modSearchDirectories.push_back(dirs::getModsDir());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,8 +141,7 @@ Result<Mod*> Loader::loadModFromInfo(ModInfo const& info) {
|
||||||
|
|
||||||
// add mod resources
|
// add mod resources
|
||||||
this->queueInGDThread([this, mod]() {
|
this->queueInGDThread([this, mod]() {
|
||||||
auto searchPath = this->getGeodeDirectory() /
|
auto searchPath = dirs::getModRuntimeDir() / mod->getID() / "resources";
|
||||||
GEODE_TEMP_DIRECTORY / mod->getID() / "resources";
|
|
||||||
|
|
||||||
CCFileUtils::get()->addSearchPath(searchPath.string().c_str());
|
CCFileUtils::get()->addSearchPath(searchPath.string().c_str());
|
||||||
this->updateModResources(mod);
|
this->updateModResources(mod);
|
||||||
|
@ -326,10 +320,6 @@ bool Loader::didLastLaunchCrash() const {
|
||||||
return crashlog::didLastLaunchCrash();
|
return crashlog::didLastLaunchCrash();
|
||||||
}
|
}
|
||||||
|
|
||||||
ghc::filesystem::path Loader::getCrashLogDirectory() const {
|
|
||||||
return crashlog::getCrashLogDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Loader::openPlatformConsole() {
|
void Loader::openPlatformConsole() {
|
||||||
InternalLoader::get()->openPlatformConsole();
|
InternalLoader::get()->openPlatformConsole();
|
||||||
}
|
}
|
||||||
|
@ -343,7 +333,7 @@ void Loader::updateModResources(Mod* mod) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto searchPath = this->getGeodeDirectory() / GEODE_TEMP_DIRECTORY / mod->getID() / "resources";
|
auto searchPath = dirs::getModRuntimeDir() / mod->getID() / "resources";
|
||||||
|
|
||||||
log::debug("Adding resources for {}", mod->getID());
|
log::debug("Adding resources for {}", mod->getID());
|
||||||
|
|
||||||
|
@ -369,12 +359,8 @@ void Loader::updateModResources(Mod* mod) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loader::addSearchPaths() {
|
void Loader::addSearchPaths() {
|
||||||
CCFileUtils::get()->addPriorityPath(
|
CCFileUtils::get()->addPriorityPath(dirs::getGeodeResourcesDir().string().c_str());
|
||||||
(this->getGeodeDirectory() / GEODE_RESOURCE_DIRECTORY).string().c_str()
|
CCFileUtils::get()->addPriorityPath(dirs::getModRuntimeDir().string().c_str());
|
||||||
);
|
|
||||||
CCFileUtils::get()->addPriorityPath(
|
|
||||||
(this->getGeodeDirectory() / GEODE_TEMP_DIRECTORY).string().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loader::updateResources() {
|
void Loader::updateResources() {
|
||||||
|
@ -388,32 +374,3 @@ void Loader::updateResources() {
|
||||||
this->updateModResources(mod);
|
this->updateModResources(mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ghc::filesystem::path Loader::getGameDirectory() const {
|
|
||||||
return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath2().c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
ghc::filesystem::path Loader::getSaveDirectory() const {
|
|
||||||
#ifdef GEODE_IS_MACOS
|
|
||||||
// not using ~/Library/Caches
|
|
||||||
return ghc::filesystem::path("/Users/Shared/Geode");
|
|
||||||
#elif defined(GEODE_IS_WINDOWS)
|
|
||||||
return ghc::filesystem::path(
|
|
||||||
ghc::filesystem::weakly_canonical(
|
|
||||||
CCFileUtils::sharedFileUtils()->getWritablePath().c_str()
|
|
||||||
).string()
|
|
||||||
);
|
|
||||||
#else
|
|
||||||
return ghc::filesystem::path(
|
|
||||||
CCFileUtils::sharedFileUtils()->getWritablePath().c_str()
|
|
||||||
);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
ghc::filesystem::path Loader::getGeodeDirectory() const {
|
|
||||||
return this->getGameDirectory() / GEODE_DIRECTORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
ghc::filesystem::path Loader::getGeodeSaveDirectory() const {
|
|
||||||
return this->getSaveDirectory() / GEODE_DIRECTORY;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include <Geode/loader/Loader.hpp>
|
#include <Geode/loader/Dirs.hpp>
|
||||||
#include <Geode/loader/Log.hpp>
|
#include <Geode/loader/Log.hpp>
|
||||||
#include <Geode/loader/Mod.hpp>
|
#include <Geode/loader/Mod.hpp>
|
||||||
#include <Geode/utils/casts.hpp>
|
#include <Geode/utils/casts.hpp>
|
||||||
|
@ -115,11 +115,7 @@ std::string Log::toString(bool logTime) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logs::setup() {
|
void Logs::setup() {
|
||||||
s_logStream = std::ofstream(
|
s_logStream = std::ofstream(dirs::getGeodeLogDir() / log::generateLogName());
|
||||||
Loader::get()->getGeodeDirectory() /
|
|
||||||
GEODE_LOG_DIRECTORY /
|
|
||||||
log::generateLogName()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logs::push(Log&& log) {
|
void Logs::push(Log&& log) {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <Geode/cocos/support/zip_support/ZipUtils.h>
|
#include <Geode/cocos/support/zip_support/ZipUtils.h>
|
||||||
#include <Geode/loader/Hook.hpp>
|
#include <Geode/loader/Hook.hpp>
|
||||||
#include <Geode/loader/Loader.hpp>
|
#include <Geode/loader/Loader.hpp>
|
||||||
|
#include <Geode/loader/Dirs.hpp>
|
||||||
#include <Geode/loader/Log.hpp>
|
#include <Geode/loader/Log.hpp>
|
||||||
#include <Geode/loader/Mod.hpp>
|
#include <Geode/loader/Mod.hpp>
|
||||||
#include <Geode/loader/Setting.hpp>
|
#include <Geode/loader/Setting.hpp>
|
||||||
|
@ -17,8 +18,7 @@ USE_GEODE_NAMESPACE();
|
||||||
|
|
||||||
Mod::Mod(ModInfo const& info) {
|
Mod::Mod(ModInfo const& info) {
|
||||||
m_info = info;
|
m_info = info;
|
||||||
m_saveDirPath = Loader::get()->getGeodeSaveDirectory() /
|
m_saveDirPath = dirs::getModsSaveDir() / info.m_id;
|
||||||
GEODE_MOD_DIRECTORY / info.m_id;
|
|
||||||
ghc::filesystem::create_directories(m_saveDirPath);
|
ghc::filesystem::create_directories(m_saveDirPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,15 +112,15 @@ Result<> Mod::createTempDir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create geode/temp
|
// Create geode/temp
|
||||||
auto tempDir = Loader::get()->getGeodeDirectory() / GEODE_TEMP_DIRECTORY;
|
auto tempDir = dirs::getModRuntimeDir();
|
||||||
if (!file::createDirectoryAll(tempDir)) {
|
if (!file::createDirectoryAll(tempDir)) {
|
||||||
return Err("Unable to create Geode temp directory");
|
return Err("Unable to create mods' runtime directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create geode/temp/mod.id
|
// Create geode/temp/mod.id
|
||||||
auto tempPath = tempDir / m_info.m_id;
|
auto tempPath = tempDir / m_info.m_id;
|
||||||
if (!file::createDirectoryAll(tempPath)) {
|
if (!file::createDirectoryAll(tempPath)) {
|
||||||
return Err("Unable to create mod temp directory");
|
return Err("Unable to create mod runtime directory");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unzip .geode file into temp dir
|
// Unzip .geode file into temp dir
|
||||||
|
@ -400,7 +400,7 @@ ghc::filesystem::path Mod::getPackagePath() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
ghc::filesystem::path Mod::getConfigDir(bool create) const {
|
ghc::filesystem::path Mod::getConfigDir(bool create) const {
|
||||||
auto dir = Loader::get()->getGeodeDirectory() / GEODE_CONFIG_DIRECTORY / m_info.m_id;
|
auto dir = dirs::getModConfigDir() / m_info.m_id;
|
||||||
if (create && !ghc::filesystem::exists(dir)) {
|
if (create && !ghc::filesystem::exists(dir)) {
|
||||||
ghc::filesystem::create_directories(dir);
|
ghc::filesystem::create_directories(dir);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <Geode/loader/Loader.hpp>
|
#include <Geode/loader/Loader.hpp>
|
||||||
#include <Geode/loader/Log.hpp>
|
#include <Geode/loader/Log.hpp>
|
||||||
|
#include <Geode/loader/Dirs.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <InternalMod.hpp>
|
#include <InternalMod.hpp>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
@ -17,7 +18,7 @@ void InternalLoader::platformMessageBox(char const* title, std::string const& in
|
||||||
void InternalLoader::openPlatformConsole() {
|
void InternalLoader::openPlatformConsole() {
|
||||||
ghc::filesystem::path(getpwuid(getuid())->pw_dir);
|
ghc::filesystem::path(getpwuid(getuid())->pw_dir);
|
||||||
freopen(
|
freopen(
|
||||||
ghc::filesystem::path(Loader::get()->getGeodeDirectory() / "geode_log.txt").string().c_str(), "w",
|
ghc::filesystem::path(dirs::getGeodeDir() / "geode_log.txt").string().c_str(), "w",
|
||||||
stdout
|
stdout
|
||||||
);
|
);
|
||||||
InternalLoader::m_platformConsoleOpen = true;
|
InternalLoader::m_platformConsoleOpen = true;
|
||||||
|
|
|
@ -10,7 +10,7 @@ bool crashlog::didLastLaunchCrash() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string crashlog::getCrashLogDirectory() {
|
ghc::filesystem::path crashlog::getCrashLogDirectory() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ bool crashlog::didLastLaunchCrash() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string crashlog::getCrashLogDirectory() {
|
ghc::filesystem::path crashlog::getCrashLogDirectory() {
|
||||||
std::array<char, 1024> path;
|
std::array<char, 1024> path;
|
||||||
CFStringGetCString(
|
CFStringGetCString(
|
||||||
(CFStringRef)NSHomeDirectory(), path.data(), path.size(), kCFStringEncodingUTF8
|
(CFStringRef)NSHomeDirectory(), path.data(), path.size(), kCFStringEncodingUTF8
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
#ifdef GEODE_IS_WINDOWS
|
#ifdef GEODE_IS_WINDOWS
|
||||||
|
|
||||||
#include <crashlog.hpp>
|
#include <crashlog.hpp>
|
||||||
|
#include <Geode/loader/Dirs.hpp>
|
||||||
|
#include <Geode/loader/Loader.hpp>
|
||||||
|
#include <Geode/loader/Mod.hpp>
|
||||||
#include <DbgHelp.h>
|
#include <DbgHelp.h>
|
||||||
#include <Geode/utils/casts.hpp>
|
#include <Geode/utils/casts.hpp>
|
||||||
#include <Geode/utils/file.hpp>
|
#include <Geode/utils/file.hpp>
|
||||||
|
@ -224,7 +226,7 @@ static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) {
|
||||||
|
|
||||||
// add a file to let Geode know on next launch that it crashed previously
|
// add a file to let Geode know on next launch that it crashed previously
|
||||||
// this could also be done by saving a loader setting or smth but eh.
|
// this could also be done by saving a loader setting or smth but eh.
|
||||||
(void)utils::file::writeBinary(crashlog::getCrashLogDirectory() + "/last-crashed", {});
|
(void)utils::file::writeBinary(crashlog::getCrashLogDirectory() / "last-crashed", {});
|
||||||
|
|
||||||
SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES);
|
SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_LOAD_LINES);
|
||||||
|
|
||||||
|
@ -273,7 +275,7 @@ static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) {
|
||||||
// save actual file
|
// save actual file
|
||||||
std::ofstream actualFile;
|
std::ofstream actualFile;
|
||||||
actualFile.open(
|
actualFile.open(
|
||||||
crashlog::getCrashLogDirectory() + "/" + getDateString(true) + ".log", std::ios::app
|
crashlog::getCrashLogDirectory() / (getDateString(true) + ".log"), std::ios::app
|
||||||
);
|
);
|
||||||
actualFile << file.rdbuf() << std::flush;
|
actualFile << file.rdbuf() << std::flush;
|
||||||
actualFile.close();
|
actualFile.close();
|
||||||
|
@ -283,7 +285,7 @@ static LONG WINAPI exceptionHandler(LPEXCEPTION_POINTERS info) {
|
||||||
|
|
||||||
bool crashlog::setupPlatformHandler() {
|
bool crashlog::setupPlatformHandler() {
|
||||||
SetUnhandledExceptionFilter(exceptionHandler);
|
SetUnhandledExceptionFilter(exceptionHandler);
|
||||||
auto lastCrashedFile = crashlog::getCrashLogDirectory() + "/last-crashed";
|
auto lastCrashedFile = crashlog::getCrashLogDirectory() / "last-crashed";
|
||||||
if (ghc::filesystem::exists(lastCrashedFile)) {
|
if (ghc::filesystem::exists(lastCrashedFile)) {
|
||||||
g_lastLaunchCrashed = true;
|
g_lastLaunchCrashed = true;
|
||||||
try {
|
try {
|
||||||
|
@ -299,9 +301,8 @@ bool crashlog::didLastLaunchCrash() {
|
||||||
return g_lastLaunchCrashed;
|
return g_lastLaunchCrashed;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string crashlog::getCrashLogDirectory() {
|
ghc::filesystem::path crashlog::getCrashLogDirectory() {
|
||||||
static auto dir = (Loader::get()->getGeodeDirectory() / "crashlogs").string();
|
return dirs::getGeodeDir() / "crashlogs";
|
||||||
return dir;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "../settings/ModSettingsPopup.hpp"
|
#include "../settings/ModSettingsPopup.hpp"
|
||||||
#include "../settings/AdvancedSettingsPopup.hpp"
|
#include "../settings/AdvancedSettingsPopup.hpp"
|
||||||
#include <InternalLoader.hpp>
|
#include <InternalLoader.hpp>
|
||||||
|
#include <Geode/loader/Dirs.hpp>
|
||||||
|
|
||||||
#include <Geode/binding/ButtonSprite.hpp>
|
#include <Geode/binding/ButtonSprite.hpp>
|
||||||
#include <Geode/binding/CCTextInputNode.hpp>
|
#include <Geode/binding/CCTextInputNode.hpp>
|
||||||
|
@ -264,9 +265,7 @@ bool ModInfoLayer::init(ModObject* obj, ModListView* list) {
|
||||||
// Check if a config directory for the mod exists
|
// Check if a config directory for the mod exists
|
||||||
// Mod::getConfigDir auto-creates the directory for user convenience, so
|
// Mod::getConfigDir auto-creates the directory for user convenience, so
|
||||||
// have to do it manually
|
// have to do it manually
|
||||||
if (ghc::filesystem::exists(
|
if (ghc::filesystem::exists(m_mod->getConfigDir(false))) {
|
||||||
Loader::get()->getGeodeDirectory() / GEODE_CONFIG_DIRECTORY / m_mod->getID()
|
|
||||||
)) {
|
|
||||||
auto configSpr = CircleButtonSprite::createWithSpriteFrameName(
|
auto configSpr = CircleButtonSprite::createWithSpriteFrameName(
|
||||||
"pencil.png"_spr, 1.f, CircleBaseColor::Green, CircleBaseSize::Medium2
|
"pencil.png"_spr, 1.f, CircleBaseColor::Green, CircleBaseSize::Medium2
|
||||||
);
|
);
|
||||||
|
@ -809,7 +808,7 @@ void ModInfoLayer::showIssueReportPopup(ModInfo const& info) {
|
||||||
"\n\n"
|
"\n\n"
|
||||||
"If your issue relates to a <cr>game crash</c>, <cb>please include</c> the "
|
"If your issue relates to a <cr>game crash</c>, <cb>please include</c> the "
|
||||||
"latest crash log(s) from `" +
|
"latest crash log(s) from `" +
|
||||||
Loader::get()->getCrashLogDirectory().string() + "`",
|
dirs::getCrashlogsDir().string() + "`",
|
||||||
"OK", (info.m_issues.value().m_url ? "Open URL" : ""),
|
"OK", (info.m_issues.value().m_url ? "Open URL" : ""),
|
||||||
[info](bool btn2) {
|
[info](bool btn2) {
|
||||||
if (btn2) {
|
if (btn2) {
|
||||||
|
@ -825,8 +824,7 @@ void ModInfoLayer::showIssueReportPopup(ModInfo const& info) {
|
||||||
"[#support](https://discord.com/channels/911701438269386882/979352389985390603) "
|
"[#support](https://discord.com/channels/911701438269386882/979352389985390603) "
|
||||||
"channnel in the [Geode Discord Server](https://discord.gg/9e43WMKzhp)\n\n"
|
"channnel in the [Geode Discord Server](https://discord.gg/9e43WMKzhp)\n\n"
|
||||||
"If your issue relates to a <cr>game crash</c>, <cb>please include</c> the "
|
"If your issue relates to a <cr>game crash</c>, <cb>please include</c> the "
|
||||||
"latest crash log(s) from `" +
|
"latest crash log(s) from `" + dirs::getCrashlogsDir().string() + "`",
|
||||||
Loader::get()->getCrashLogDirectory().string() + "`",
|
|
||||||
"OK"
|
"OK"
|
||||||
)
|
)
|
||||||
->show();
|
->show();
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <Geode/ui/BasedButton.hpp>
|
#include <Geode/ui/BasedButton.hpp>
|
||||||
#include <Geode/ui/Notification.hpp>
|
#include <Geode/ui/Notification.hpp>
|
||||||
#include <Geode/utils/casts.hpp>
|
#include <Geode/utils/casts.hpp>
|
||||||
|
#include <Geode/loader/Dirs.hpp>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
static ModListType g_tab = ModListType::Installed;
|
static ModListType g_tab = ModListType::Installed;
|
||||||
|
@ -382,7 +383,7 @@ void ModListLayer::onFilters(CCObject*) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModListLayer::onOpenFolder(CCObject*) {
|
void ModListLayer::onOpenFolder(CCObject*) {
|
||||||
file::openFolder(ghc::filesystem::canonical(Loader::get()->getGeodeDirectory() / "mods"));
|
file::openFolder(ghc::filesystem::canonical(dirs::getModsDir()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModListLayer::onResetSearch(CCObject*) {
|
void ModListLayer::onResetSearch(CCObject*) {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <Geode/binding/Slider.hpp>
|
#include <Geode/binding/Slider.hpp>
|
||||||
#include <Geode/binding/CCMenuItemToggler.hpp>
|
#include <Geode/binding/CCMenuItemToggler.hpp>
|
||||||
#include <Geode/loader/Loader.hpp>
|
#include <Geode/loader/Loader.hpp>
|
||||||
|
#include <Geode/loader/Dirs.hpp>
|
||||||
|
|
||||||
// BoolSettingNode
|
// BoolSettingNode
|
||||||
|
|
||||||
|
@ -122,7 +123,7 @@ void FileSettingNode::onPickFile(CCObject*) {
|
||||||
if (auto path = file::pickFile(
|
if (auto path = file::pickFile(
|
||||||
file::PickMode::OpenFile,
|
file::PickMode::OpenFile,
|
||||||
{
|
{
|
||||||
Loader::get()->getGameDirectory(),
|
dirs::getGameDir(),
|
||||||
setting->getFileFilters().value_or(std::vector<file::FilePickOptions::Filter>())
|
setting->getFileFilters().value_or(std::vector<file::FilePickOptions::Filter>())
|
||||||
}
|
}
|
||||||
)) {
|
)) {
|
||||||
|
|
Loading…
Reference in a new issue