diff --git a/lib/libimhex/source/helpers/fs.cpp b/lib/libimhex/source/helpers/fs.cpp index 352ba642c..ab6e30d5e 100644 --- a/lib/libimhex/source/helpers/fs.cpp +++ b/lib/libimhex/source/helpers/fs.cpp @@ -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