make getGameDir weaklyCanonical

This commit is contained in:
altalk23 2023-04-28 15:03:58 +03:00
parent 7af062f35d
commit c174f81998

View file

@ -6,22 +6,27 @@
using namespace geode::prelude;
namespace {
ghc::filesystem::path weaklyCanonical(ghc::filesystem::path const& path) {
#ifdef GEODE_IS_WINDOWS
// this is std::filesystem intentionally because ghc version doesnt want to work with softlinked directories
return std::filesystem::weakly_canonical(path.string()).string();
#else
return ghc::filesystem::weakly_canonical(path.string()).string();
#endif
}
}
ghc::filesystem::path dirs::getGameDir() {
return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath2().c_str());
return weaklyCanonical(CCFileUtils::sharedFileUtils()->getWritablePath2().c_str());
}
ghc::filesystem::path dirs::getSaveDir() {
#ifdef GEODE_IS_MACOS
// not using ~/Library/Caches
return ghc::filesystem::path("/Users/Shared/Geode");
#elif defined(GEODE_IS_WINDOWS)
// this is std::filesystem intentionally because ghc version doesnt want to work with softlinked directories
return ghc::filesystem::path(
std::filesystem::weakly_canonical(CCFileUtils::sharedFileUtils()->getWritablePath().c_str())
.string()
);
#else
return ghc::filesystem::path(CCFileUtils::sharedFileUtils()->getWritablePath().c_str());
return weaklyCanonical(CCFileUtils::sharedFileUtils()->getWritablePath().c_str());
#endif
}