mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-21 14:40:26 -06:00
Windows: Tolerate GetShortPathNameW failure
This function is used by NMake Makefile generator, but when shortening path fails, it previously returned an empty string. `ERROR_ACCESS_DENIED` is returned for paths within `C:\Program Files\WindowsApps`, which is a special folder with limited access rights. It looks like this is [by design](https://superuser.com/a/1730061/213587). Fixes: #24853
This commit is contained in:
committed by
Brad King
parent
827d5b75d4
commit
a368a59467
@@ -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;
|
||||
}();
|
||||
|
||||
Reference in New Issue
Block a user