Explorar o código

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

Brad King %!s(int64=21) %!d(string=hai) anos
pai
achega
a2949c204d
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  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)
     {