Merge topic 'fix-short-path'

a368a59467 Windows: Tolerate GetShortPathNameW failure

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8432
This commit is contained in:
Brad King
2023-04-27 13:07:07 +00:00
committed by Kitware Robot

View File

@@ -175,7 +175,12 @@ std::string cmOutputConverter::ConvertToOutputForExisting(
}
std::string tmp{};
cmSystemTools::GetShortPath(remote, tmp);
cmsys::Status status = cmSystemTools::GetShortPath(remote, tmp);
if (!status) {
// Fallback for cases when Windows refuses to resolve the short path,
// like for C:\Program Files\WindowsApps\...
tmp = remote;
}
shortPathCache[remote] = tmp;
return tmp;
}();