From 8c8379448e6cc9c447dead23f7cae11e70b644eb Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Mon, 7 Jun 2004 13:55:20 -0400
Subject: [PATCH] BUG: Do not create a directory on top of a file.

---
 SystemTools.cxx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/SystemTools.cxx b/SystemTools.cxx
index 50c0b3ff..9f58050f 100644
--- a/SystemTools.cxx
+++ b/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)
     {
-- 
GitLab