This commit is contained in:
altalk23 2023-05-01 18:41:36 +03:00
commit a968153331
2 changed files with 13 additions and 8 deletions

View file

@ -18,10 +18,10 @@ int loadGeode(PVOID module) {
}
DWORD WINAPI load(PVOID module) {
std::array<TCHAR, MAX_PATH> szFileName;
GetModuleFileName(NULL, szFileName.data(), MAX_PATH);
std::array<WCHAR, MAX_PATH> szFileName;
GetModuleFileNameW(NULL, szFileName.data(), MAX_PATH);
ghc::filesystem::path path(szFileName.data());
const ghc::filesystem::path path(szFileName.data());
auto workingDir = path.parent_path();
auto updatesDir = workingDir / "geode" / "update";
auto resourcesDir = workingDir / "geode" / "resources";

View file

@ -116,12 +116,17 @@ CCPoint cocos::getMousePos() {
}
ghc::filesystem::path dirs::getGameDir() {
std::array<TCHAR, MAX_PATH> szFileName;
GetModuleFileName(NULL, szFileName.data(), MAX_PATH);
// only fetch the path once, since ofc it'll never change
// throughout the execution
static const auto path = [] {
std::array<WCHAR, MAX_PATH> buffer;
GetModuleFileNameW(NULL, buffer.data(), MAX_PATH);
ghc::filesystem::path path(szFileName.data());
auto currentPath = path.parent_path();
return currentPath;
const ghc::filesystem::path path(buffer.data());
return path.parent_path();
}();
return path;
}
#endif