Permalink
Browse files

GH-1997 fix off by one error in 8.3 path logic

  • Loading branch information...
peterix committed Sep 27, 2017
1 parent d276da1 commit 79d208795c4f1fab88caa7e1684cfbb3c37fc185
Showing with 5 additions and 0 deletions.
  1. +5 −0 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;
}

0 comments on commit 79d2087

Please sign in to comment.