From: Benjamin Kramer Date: Thu, 5 Nov 2009 14:32:40 +0000 (+0000) Subject: Path::createDirectoryOnDisk should ignore existing directories on win32 too. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=e9684c682aab1b6bfd4da547d9ad395b2f831f4e;p=oota-llvm.git Path::createDirectoryOnDisk should ignore existing directories on win32 too. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86132 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc index 46b965f4b05..573369e97d4 100644 --- a/lib/System/Win32/Path.inc +++ b/lib/System/Win32/Path.inc @@ -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: "); } }