diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-03 05:42:11 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-03 05:42:11 +0000 |
commit | 31e310cda0e1660e3bada29096e29796aabe059a (patch) | |
tree | 7bd51cf9ee84c23f92c087d970a12c97c141d5c2 /llvm/lib/Support/Windows | |
parent | 4a5fcbb92b2981589cf9fb1771d06a1f2ff775e2 (diff) | |
download | bcm5719-llvm-31e310cda0e1660e3bada29096e29796aabe059a.tar.gz bcm5719-llvm-31e310cda0e1660e3bada29096e29796aabe059a.zip |
Support/FileSystem: Add create_director{y,ies} implementations.
llvm-svn: 120790
Diffstat (limited to 'llvm/lib/Support/Windows')
-rw-r--r-- | llvm/lib/Support/Windows/PathV2.inc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Support/Windows/PathV2.inc b/llvm/lib/Support/Windows/PathV2.inc index a93ac224a3d..4adbda3cab1 100644 --- a/llvm/lib/Support/Windows/PathV2.inc +++ b/llvm/lib/Support/Windows/PathV2.inc @@ -181,6 +181,26 @@ error_code copy_file(const Twine &from, const Twine &to, copy_option copt) { return make_error_code(errc::success); } +error_code create_directory(const Twine &path, bool &existed) { + SmallString<128> path_storage; + SmallVector<wchar_t, 128> path_utf16; + + if (error_code ec = UTF8ToUTF16(path.toStringRef(path_storage), + path_utf16)) + return ec; + + if (!::CreateDirectoryW(path_utf16.begin(), NULL)) { + error_code ec = make_error_code(windows_error(::GetLastError())); + if (ec == make_error_code(windows_error::already_exists)) + existed = true; + else + return ec; + } else + existed = false; + + return make_error_code(errc::success); +} + error_code exists(const Twine &path, bool &result) { SmallString<128> path_storage; SmallVector<wchar_t, 128> path_utf16; |