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/Unix/PathV2.inc | |
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/Unix/PathV2.inc')
-rw-r--r-- | llvm/lib/Support/Unix/PathV2.inc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Support/Unix/PathV2.inc b/llvm/lib/Support/Unix/PathV2.inc index 1368a82658f..fc0d4a09a73 100644 --- a/llvm/lib/Support/Unix/PathV2.inc +++ b/llvm/lib/Support/Unix/PathV2.inc @@ -146,6 +146,20 @@ 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; + StringRef p = path.toNullTerminatedStringRef(path_storage); + + if (::mkdir(p.begin(), 0700) == -1) { + if (errno != EEXIST) + return error_code(errno, system_category()); + existed = true; + } else + existed = false; + + return make_error_code(errc::success); +} + error_code exists(const Twine &path, bool &result) { SmallString<128> path_storage; StringRef p = path.toNullTerminatedStringRef(path_storage); |