[Lldb-commits] [lldb] r234610 - Use llvm::sys::fs::create_directories to create new directory on Windows.

Oleksiy Vyalov ovyalov at google.com
Fri Apr 10 10:02:27 PDT 2015


Author: ovyalov
Date: Fri Apr 10 12:02:26 2015
New Revision: 234610

URL: http://llvm.org/viewvc/llvm-project?rev=234610&view=rev
Log:
Use llvm::sys::fs::create_directories to create new directory on Windows.

http://reviews.llvm.org/D8977


Modified:
    lldb/trunk/source/Host/windows/FileSystem.cpp

Modified: lldb/trunk/source/Host/windows/FileSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/FileSystem.cpp?rev=234610&r1=234609&r2=234610&view=diff
==============================================================================
--- lldb/trunk/source/Host/windows/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/windows/FileSystem.cpp Fri Apr 10 12:02:26 2015
@@ -12,6 +12,7 @@
 #include <shellapi.h>
 
 #include "lldb/Host/FileSystem.h"
+#include "llvm/Support/FileSystem.h"
 
 using namespace lldb_private;
 
@@ -27,8 +28,12 @@ FileSystem::MakeDirectory(const char *pa
     // 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;
 }
 





More information about the lldb-commits mailing list