From cc815568314d2231eb755d9626303b8ce614adc6 Mon Sep 17 00:00:00 2001 From: Oleksiy Vyalov Date: Fri, 10 Apr 2015 17:02:26 +0000 Subject: [PATCH] Use llvm::sys::fs::create_directories to create new directory on Windows. http://reviews.llvm.org/D8977 llvm-svn: 234610 --- lldb/source/Host/windows/FileSystem.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lldb/source/Host/windows/FileSystem.cpp b/lldb/source/Host/windows/FileSystem.cpp index f1926357b552..de2374c80cab 100644 --- a/lldb/source/Host/windows/FileSystem.cpp +++ b/lldb/source/Host/windows/FileSystem.cpp @@ -12,6 +12,7 @@ #include #include "lldb/Host/FileSystem.h" +#include "llvm/Support/FileSystem.h" using namespace lldb_private; @@ -27,8 +28,12 @@ FileSystem::MakeDirectory(const char *path, uint32_t file_permissions) // On Win32, the mode parameter is ignored, as Windows files and directories support a // different permission model than POSIX. Error error; - if (!::CreateDirectory(path, NULL) && GetLastError() != ERROR_ALREADY_EXISTS) - error.SetError(::GetLastError(), lldb::eErrorTypeWin32); + const auto err_code = llvm::sys::fs::create_directories(path, true); + if (err_code) + { + error.SetErrorString(err_code.message().c_str()); + } + return error; }