浏览代码

Merge branch 'upstream-KWSys' into update-kwsys

* upstream-KWSys:
  KWSys 2016-08-24 (8e643b9b)
Brad King 9 年之前
父节点
当前提交
7bc6dccc0a
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      Source/kwsys/SystemTools.cxx

+ 5 - 2
Source/kwsys/SystemTools.cxx

@@ -4725,8 +4725,11 @@ bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath)
   std::wstring wtempPath = Encoding::ToWide(tempPath);
   DWORD ret = GetShortPathNameW(wtempPath.c_str(), NULL, 0);
   std::vector<wchar_t> buffer(ret);
-  ret = GetShortPathNameW(wtempPath.c_str(),
-                          &buffer[0], static_cast<DWORD>(buffer.size()));
+  if (ret != 0)
+    {
+    ret = GetShortPathNameW(wtempPath.c_str(),
+                            &buffer[0], static_cast<DWORD>(buffer.size()));
+    }
 
   if (ret == 0)
     {