Просмотр исходного кода

Merge topic 'fix-short-path'

a368a59467 Windows: Tolerate GetShortPathNameW failure

Acked-by: Kitware Robot <[email protected]>
Merge-request: !8432
Brad King 2 лет назад
Родитель
Сommit
5f40448da5
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      Source/cmOutputConverter.cxx

+ 6 - 1
Source/cmOutputConverter.cxx

@@ -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;
     }();