Windows: Make TEMP dir detection long path aware.

This commit is contained in:
Unknown W. Brackets committed 2020-01-04 11:06:12 -08:00
1 parent 61e4818419
commit dc26fb8ef7
1 file changed
+8 -2
+8 -2
View File
@@ -96,8 +96,14 @@ static bool IsTempPath(const std::string &str) {
// Normalize slashes.
item = ReplaceAll(str, "/", "\\");
wchar_t tempPath[MAX_PATH];
GetTempPath(MAX_PATH, tempPath);
std::wstring tempPath(MAX_PATH, '\0');
size_t sz = GetTempPath((DWORD)tempPath.size(), &tempPath[0]);
if (sz >= tempPath.size()) {
tempPath.resize(sz);
sz = GetTempPath((DWORD)tempPath.size(), &tempPath[0]);
}
// Need to resize off the null terminator either way.
tempPath.resize(sz);
if (testPath(ConvertWStringToUTF8(tempPath)))
return true;
#endif