mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-26 04:39:51 -04:00
don't rely on filesystem current_path
This commit is contained in:
parent
d60782fee1
commit
dc96da012d
4 changed files with 18 additions and 12 deletions
loader
|
@ -17,7 +17,11 @@ int loadGeode(PVOID module) {
|
|||
}
|
||||
|
||||
DWORD WINAPI load(PVOID module) {
|
||||
auto workingDir = ghc::filesystem::current_path();
|
||||
std::array<TCHAR, MAX_PATH> szFileName;
|
||||
GetModuleFileName(NULL, szFileName.data(), MAX_PATH);
|
||||
|
||||
ghc::filesystem::path path(szFileName);
|
||||
auto workingDir = path.parent_path();
|
||||
auto updatesDir = workingDir / "geode" / "update";
|
||||
auto resourcesDir = workingDir / "geode" / "resources";
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace {
|
|||
}
|
||||
|
||||
ghc::filesystem::path dirs::getGameDir() {
|
||||
return weaklyCanonical(CCFileUtils::sharedFileUtils()->getWritablePath2().c_str());
|
||||
return utils::file::current_path();
|
||||
}
|
||||
|
||||
ghc::filesystem::path dirs::getSaveDir() {
|
||||
|
|
|
@ -149,17 +149,14 @@ CCPoint cocos::getMousePos() {
|
|||
}
|
||||
|
||||
ghc::filesystem::path utils::file::current_path() {
|
||||
// if it's just a slash because for some reason it is
|
||||
if (ghc::filesystem::current_path().string().size() < 2) {
|
||||
std::array<char, PATH_MAX> gddir;
|
||||
std::array<char, PATH_MAX> gddir;
|
||||
|
||||
uint32_t out = PATH_MAX;
|
||||
_NSGetExecutablePath(gddir.data(), &out);
|
||||
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();
|
||||
ghc::filesystem::path gdpath = gddir.data();
|
||||
auto currentPath = gdpath.parent_path().parent_path();
|
||||
return currentPath;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -116,7 +116,12 @@ CCPoint cocos::getMousePos() {
|
|||
}
|
||||
|
||||
ghc::filesystem::path utils::file::current_path() {
|
||||
return ghc::filesystem::current_path();
|
||||
std::array<TCHAR, MAX_PATH> szFileName;
|
||||
GetModuleFileName(NULL, szFileName.data(), MAX_PATH);
|
||||
|
||||
ghc::filesystem::path path(szFileName);
|
||||
auto currentPath = path.parent_path();
|
||||
return currentPath;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue