Path::createDirectoryOnDisk should ignore existing directories on win32 too.

llvm-svn: 86132
This commit is contained in:
Benjamin Kramer 2009-11-05 14:32:40 +00:00
parent 73818d685e
commit 9470ecdb2c
1 changed files with 4 additions and 2 deletions

View 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: ");
}
}