mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-25 04:11:42 -04:00
use weakly_canonical in getGameDir and getSaveDir
This commit is contained in:
parent
68357143e8
commit
46fab0e821
2 changed files with 5 additions and 14 deletions
|
@ -7,17 +7,6 @@
|
|||
|
||||
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::getGeodeDir() {
|
||||
return dirs::getGameDir() / "geode";
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ using namespace geode::prelude;
|
|||
#include <Geode/utils/web.hpp>
|
||||
#include <Geode/utils/cocos.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
bool utils::clipboard::write(std::string const& data) {
|
||||
if (!OpenClipboard(nullptr)) return false;
|
||||
if (!EmptyClipboard()) {
|
||||
|
@ -124,7 +126,7 @@ ghc::filesystem::path dirs::getGameDir() {
|
|||
GetModuleFileNameW(NULL, buffer.data(), MAX_PATH);
|
||||
|
||||
const ghc::filesystem::path path(buffer.data());
|
||||
return path.parent_path();
|
||||
return std::filesystem::weakly_canonical(path.parent_path().wstring()).wstring();
|
||||
}();
|
||||
|
||||
return path;
|
||||
|
@ -146,11 +148,11 @@ ghc::filesystem::path dirs::getSaveDir() {
|
|||
auto savePath = appdataPath / executableName;
|
||||
|
||||
if (SHCreateDirectoryExW(NULL, savePath.wstring().c_str(), NULL) >= 0) {
|
||||
return savePath;
|
||||
return std::filesystem::weakly_canonical(savePath.wstring()).wstring();
|
||||
}
|
||||
}
|
||||
|
||||
return executablePath.parent_path();
|
||||
return std::filesystem::weakly_canonical(executablePath.parent_path().wstring()).wstring();
|
||||
}();
|
||||
|
||||
return path;
|
||||
|
|
Loading…
Add table
Reference in a new issue