1
0
mirror of synced 2025-01-18 09:04:52 +01:00

fix: Pattern auto-loading issue on Windows (#808)

This commit is contained in:
Asvel 2022-10-30 20:39:40 +08:00 committed by GitHub
parent bececff9e5
commit c35eaa7a4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -266,12 +266,13 @@ namespace hex::fs {
std::fs::path toShortPath(const std::fs::path &path) {
#if defined(OS_WINDOWS)
size_t size = GetShortPathNameW(path.c_str(), nullptr, 0) * sizeof(TCHAR);
size_t size = GetShortPathNameW(path.c_str(), nullptr, 0);
if (size == 0)
return path;
std::wstring newPath(size, 0x00);
GetShortPathNameW(path.c_str(), newPath.data(), newPath.size());
newPath.pop_back();
return newPath;
#else