mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-02 08:09:57 -04:00
Fix resources because of broken working directory
This commit is contained in:
parent
95f046b98e
commit
e3bda2a544
10 changed files with 37 additions and 14 deletions
|
@ -1,5 +1,8 @@
|
|||
# Geode Changelog
|
||||
|
||||
## v1.0.0-beta.16
|
||||
* Fix mod.json not loading because of broken working directory on MacOS
|
||||
|
||||
## v1.0.0-beta.15
|
||||
* Fix `ghc::filesystem::create_directories` crash on wine (c174f81)
|
||||
* Fix fuzzy search giving meaningless results (7af062f)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
1.0.0-beta.15
|
||||
1.0.0-beta.16
|
|
@ -60,6 +60,8 @@ namespace geode::utils::file {
|
|||
ghc::filesystem::path const& path, bool recursive = false
|
||||
);
|
||||
|
||||
GEODE_DLL ghc::filesystem::path current_path();
|
||||
|
||||
class Unzip;
|
||||
|
||||
class GEODE_DLL Zip final {
|
||||
|
|
|
@ -17,7 +17,7 @@ int loadGeode(PVOID module) {
|
|||
}
|
||||
|
||||
DWORD WINAPI load(PVOID module) {
|
||||
auto workingDir = ghc::filesystem::current_path();
|
||||
auto workingDir = utils::file::current_path();
|
||||
auto updatesDir = workingDir / "geode" / "update";
|
||||
auto resourcesDir = workingDir / "geode" / "resources";
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <cocos2d.h>
|
||||
#include <crashlog.hpp>
|
||||
#include <filesystem>
|
||||
#include "LoaderImpl.hpp"
|
||||
|
||||
using namespace geode::prelude;
|
||||
|
||||
|
@ -32,7 +33,7 @@ ghc::filesystem::path dirs::getSaveDir() {
|
|||
|
||||
ghc::filesystem::path dirs::getGeodeDir() {
|
||||
#ifdef GEODE_IS_MACOS
|
||||
return ghc::filesystem::current_path() / "geode";
|
||||
return utils::file::current_path() / "geode";
|
||||
#else
|
||||
return dirs::getGameDir() / "geode";
|
||||
#endif
|
||||
|
@ -43,6 +44,10 @@ ghc::filesystem::path dirs::getGeodeSaveDir() {
|
|||
}
|
||||
|
||||
ghc::filesystem::path dirs::getGeodeResourcesDir() {
|
||||
LoaderImpl::get()->platformMessageBox(
|
||||
"Fatal Internal Error",
|
||||
(dirs::getGeodeDir() / "resources").string()
|
||||
);
|
||||
return dirs::getGeodeDir() / "resources";
|
||||
}
|
||||
|
||||
|
|
|
@ -685,7 +685,7 @@ static Result<ModInfo> getModImplInfo() {
|
|||
json = json::parse(data.unwrap());
|
||||
}
|
||||
else {
|
||||
return Err("Unable to find mod.json");
|
||||
return Err("Unable to find mod.json at " + jsonPath.string());
|
||||
}
|
||||
} catch (std::exception& err) {
|
||||
return Err("Unable to parse mod.json: " + std::string(err.what()));
|
||||
|
|
|
@ -31,15 +31,7 @@ void dynamicEntry() {
|
|||
auto dylib = dlopen("GeodeBootstrapper.dylib", RTLD_NOLOAD);
|
||||
dlclose(dylib);
|
||||
|
||||
std::array<char, PATH_MAX> gddir;
|
||||
|
||||
uint32_t out = PATH_MAX;
|
||||
_NSGetExecutablePath(gddir.data(), &out);
|
||||
|
||||
ghc::filesystem::path gdpath = gddir.data();
|
||||
ghc::filesystem::current_path(gdpath.parent_path().parent_path());
|
||||
|
||||
auto workingDir = gdpath.parent_path().parent_path();
|
||||
auto workingDir = utils::file::current_path();
|
||||
auto libDir = workingDir / "Frameworks";
|
||||
auto updatesDir = workingDir / "geode" / "update";
|
||||
|
||||
|
@ -74,7 +66,7 @@ DWORD WINAPI loadThread(void* arg) {
|
|||
}
|
||||
|
||||
if (canMoveBootstrapper) {
|
||||
auto workingDir = ghc::filesystem::current_path();
|
||||
auto workingDir = utils::file::current_path();
|
||||
auto updatesDir = workingDir / "geode" / "update";
|
||||
|
||||
auto error = std::error_code();
|
||||
|
|
|
@ -28,4 +28,8 @@ void geode_nslog(uintptr_t x) {
|
|||
NSLog(@"geode %lx", x);
|
||||
}
|
||||
|
||||
ghc::filesystem::path utils::file::current_path() {
|
||||
return ghc::filesystem::current_path();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -148,4 +148,17 @@ CCPoint cocos::getMousePos() {
|
|||
return ccp(mouse.x - frame.origin.x, mouse.y - frame.origin.y) * scaleFactor;
|
||||
}
|
||||
|
||||
ghc::filesystem::path utils::file::current_path() {
|
||||
if (ghc::filesystem::current_path().empty()) {
|
||||
std::array<char, PATH_MAX> gddir;
|
||||
|
||||
uint32_t out = PATH_MAX;
|
||||
_NSGetExecutablePath(gddir.data(), &out);
|
||||
|
||||
ghc::filesystem::path gdpath = gddir.data();
|
||||
ghc::filesystem::current_path(gdpath.parent_path().parent_path());
|
||||
}
|
||||
return ghc::filesystem::current_path();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -115,4 +115,8 @@ CCPoint cocos::getMousePos() {
|
|||
return ccp(mouse.x, 1.f - mouse.y) * winSize;
|
||||
}
|
||||
|
||||
ghc::filesystem::path utils::file::current_path() {
|
||||
return ghc::filesystem::current_path();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue