浏览代码

BUG: Do not create a directory on top of a file.

Brad King 21 年之前
父节点
当前提交
a2949c204d
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      Source/kwsys/SystemTools.cxx

+ 7 - 1
Source/kwsys/SystemTools.cxx

@@ -235,10 +235,16 @@ const char* SystemTools::GetExecutableExtension()
 
 bool SystemTools::MakeDirectory(const char* path)
 {
-  if(SystemTools::FileExists(path))
+  if(SystemTools::FileIsDirectory(path))
     {
     return true;
     }
+
+  // Do not make a directory on top of a file.
+  if(SystemTools::FileExists(path))
+    {
+    return false;
+    }
   kwsys_stl::string dir = path;
   if(dir.size() == 0)
     {