diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-09-27 04:28:21 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-09-27 04:28:21 +0200 |
commit | 79d208795c4f1fab88caa7e1684cfbb3c37fc185 (patch) | |
tree | 57be7370a8f25ac715d31e861e5fadba43b2c089 /api/logic | |
parent | d276da13598e14f2d561d9ffb053c07af59eca82 (diff) | |
download | MultiMC-79d208795c4f1fab88caa7e1684cfbb3c37fc185.tar MultiMC-79d208795c4f1fab88caa7e1684cfbb3c37fc185.tar.gz MultiMC-79d208795c4f1fab88caa7e1684cfbb3c37fc185.tar.lz MultiMC-79d208795c4f1fab88caa7e1684cfbb3c37fc185.tar.xz MultiMC-79d208795c4f1fab88caa7e1684cfbb3c37fc185.zip |
GH-1997 fix off by one error in 8.3 path logic
Diffstat (limited to 'api/logic')
-rw-r--r-- | api/logic/minecraft/launch/LauncherPartLaunch.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/api/logic/minecraft/launch/LauncherPartLaunch.cpp b/api/logic/minecraft/launch/LauncherPartLaunch.cpp index c5b2219a..9b9889a4 100644 --- a/api/logic/minecraft/launch/LauncherPartLaunch.cpp +++ b/api/logic/minecraft/launch/LauncherPartLaunch.cpp @@ -36,8 +36,13 @@ QString shortPathName(const QString & file) auto input = file.toStdWString(); std::wstring output; long length = GetShortPathNameW(input.c_str(), NULL, 0); + // NOTE: this resizing might seem weird... + // when GetShortPathNameW fails, it returns length including null character + // when it succeeds, it returns length excluding null character + // See: https://msdn.microsoft.com/en-us/library/windows/desktop/aa364989(v=vs.85).aspx output.resize(length); GetShortPathNameW(input.c_str(),(LPWSTR)output.c_str(),length); + output.resize(length-1); QString ret = QString::fromStdWString(output); return ret; } |