remove geodeRoot

This commit is contained in:
HJfod 2022-11-30 18:37:15 +02:00
parent 1807f19b51
commit 8126175eaa
7 changed files with 9 additions and 25 deletions

View file

@ -81,7 +81,6 @@ namespace geode::utils::file {
*/
GEODE_DLL Result<> unzipTo(ghc::filesystem::path const& from, ghc::filesystem::path const& to);
GEODE_DLL ghc::filesystem::path geodeRoot();
GEODE_DLL bool openFolder(ghc::filesystem::path const& path);
enum class PickMode {

View file

@ -411,7 +411,7 @@ ghc::filesystem::path Loader::getSaveDirectory() const {
}
ghc::filesystem::path Loader::getGeodeDirectory() const {
return geode::utils::file::geodeRoot() / GEODE_DIRECTORY;
return this->getGameDirectory() / GEODE_DIRECTORY;
}
ghc::filesystem::path Loader::getGeodeSaveDirectory() const {

View file

@ -1,10 +1,11 @@
#include <InternalLoader.hpp>
#include <Geode/loader/Log.hpp>
#include <iostream>
#include <InternalMod.hpp>
#ifdef GEODE_IS_IOS
#include <Geode/loader/Loader.hpp>
#include <Geode/loader/Log.hpp>
#include <iostream>
#include <InternalMod.hpp>
#include <pwd.h>
#include <sys/types.h>
#include <unistd.h>
@ -16,7 +17,7 @@ void InternalLoader::platformMessageBox(char const* title, std::string const& in
void InternalLoader::openPlatformConsole() {
ghc::filesystem::path(getpwuid(getuid())->pw_dir);
freopen(
ghc::filesystem::path(utils::file::geodeRoot() / "geode_log.txt").string().c_str(), "w",
ghc::filesystem::path(Loader::get()->getGeodeDirectory() / "geode_log.txt").string().c_str(), "w",
stdout
);
InternalLoader::m_platformConsoleOpen = true;

View file

@ -19,13 +19,6 @@ std::string utils::clipboard::read() {
return std::string([[UIPasteboard generalPasteboard].string UTF8String]);
}
ghc::filesystem::path utils::file::geodeRoot() {
return ghc::filesystem::path([[[NSFileManager defaultManager]
URLsForDirectory:NSDocumentDirectory
inDomains:NSUserDomainMask] lastObject]
.path.UTF8String);
}
void utils::web::openLinkInBrowser(std::string const& url) {
[[UIApplication sharedApplication]
openURL:[NSURL URLWithString:[NSString stringWithUTF8String:url.c_str()]]];

View file

@ -27,13 +27,6 @@ std::string utils::clipboard::read() {
return std::string(clipboard);
}
ghc::filesystem::path utils::file::geodeRoot() {
char cwd[PATH_MAX];
getcwd(cwd, sizeof(cwd));
// utils::clipboard::write(cwd);
return ghc::filesystem::path(cwd);
}
bool utils::file::openFolder(ghc::filesystem::path const& path) {
NSURL* fileURL = [NSURL fileURLWithPath:[NSString stringWithUTF8String:path.string().c_str()]];
NSURL* folderURL = [fileURL URLByDeletingLastPathComponent];

View file

@ -70,10 +70,6 @@ std::string utils::clipboard::read() {
return text;
}
ghc::filesystem::path utils::file::geodeRoot() {
return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath2().c_str());
}
bool utils::file::openFolder(ghc::filesystem::path const& path) {
ShellExecuteA(NULL, "open", path.string().c_str(), NULL, NULL, SW_SHOWDEFAULT);
return true;

View file

@ -4,6 +4,8 @@
#include <Geode/binding/CCTextInputNode.hpp>
#include <Geode/binding/ColorChannelSprite.hpp>
#include <Geode/binding/Slider.hpp>
#include <Geode/binding/CCMenuItemToggler.hpp>
#include <Geode/loader/Loader.hpp>
// BoolSettingNode
@ -120,7 +122,7 @@ void FileSettingNode::onPickFile(CCObject*) {
if (auto path = file::pickFile(
file::PickMode::OpenFile,
{
file::geodeRoot(),
Loader::get()->getGameDirectory(),
setting->getFileFilters().value_or(std::vector<file::FilePickOptions::Filter>())
}
)) {