From 7beae6b8972ffc06061068df103bf6e1fd61c30b Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Mon, 9 Feb 2009 16:45:15 -0500
Subject: [PATCH] BUG: Work around broken GetLongPathName case

On Windows the GetLongPathName API function does not work on some
filesystems even if the file exists.  In this case we should just use
the original long path name and not the GetShortPathName result.
See issue #8480.
---
 SystemTools.cxx | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/SystemTools.cxx b/SystemTools.cxx
index 2bb4450..f8311fc 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -3058,6 +3058,11 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const char* p)
     {
     return p;
     }
+  // Use original path if conversion back to a long path failed.
+  if(longPath == shortPath)
+    {
+    longPath = p;
+    }
   // make sure drive letter is always upper case
   if(longPath.size() > 1 && longPath[1] == ':')
     {
-- 
GitLab