[Lldb-commits] [PATCH] Use SHCreateDirectory to create new directory on Windows
Oleksiy Vyalov
ovyalov at google.com
Fri Apr 10 09:21:04 PDT 2015
Hi zturner,
Use SHCreateDirectory to create new directory on Windows - to allow recursive creation of non-existing folders.
http://reviews.llvm.org/D8977
Files:
source/Host/windows/FileSystem.cpp
Index: source/Host/windows/FileSystem.cpp
===================================================================
--- source/Host/windows/FileSystem.cpp
+++ source/Host/windows/FileSystem.cpp
@@ -10,6 +10,8 @@
#include "lldb/Host/windows/windows.h"
#include <shellapi.h>
+#include <Shlobj.h>
+#include <string>
#include "lldb/Host/FileSystem.h"
@@ -27,8 +29,12 @@
// 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 std::string a_path(path);
+ const std::wstring w_path(a_path.begin(), a_path.end());
+ const auto res = ::SHCreateDirectory(NULL, w_path.c_str());
+ if (res != ERROR_SUCCESS && res != ERROR_ALREADY_EXISTS)
+ error.SetError(res, lldb::eErrorTypeWin32);
+
return error;
}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8977.23607.patch
Type: text/x-patch
Size: 980 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150410/5522a2c6/attachment.bin>
More information about the lldb-commits
mailing list