Path::createDirectoryOnDisk should ignore existing directories on win32 too.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 5 Nov 2009 14:32:40 +0000 (14:32 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 5 Nov 2009 14:32:40 +0000 (14:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86132 91177308-0d34-0410-b5e6-96231b3b80d8

lib/System/Win32/Path.inc

index 46b965f4b05206bb24e6694802331965ebf14676..573369e97d492b2f2c797a1a954d7e6a820e8197 100644 (file)
@@ -608,7 +608,8 @@ Path::createDirectoryOnDisk(bool create_parents, std::string* ErrMsg) {
     while (*next) {
       next = strchr(next, '/');
       *next = 0;
-      if (!CreateDirectory(pathname, NULL))
+      if (!CreateDirectory(pathname, NULL) &&
+          GetLastError() != ERROR_ALREADY_EXISTS)
           return MakeErrMsg(ErrMsg, 
             std::string(pathname) + ": Can't create directory: ");
       *next++ = '/';
@@ -616,7 +617,8 @@ Path::createDirectoryOnDisk(bool create_parents, std::string* ErrMsg) {
   } else {
     // Drop trailing slash.
     pathname[len-1] = 0;
-    if (!CreateDirectory(pathname, NULL)) {
+    if (!CreateDirectory(pathname, NULL) &&
+        GetLastError() != ERROR_ALREADY_EXISTS) {
       return MakeErrMsg(ErrMsg, std::string(pathname) + ": Can't create directory: ");
     }
   }