diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-03-06 17:36:46 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-03-06 17:36:46 +0000 |
commit | bd3f9c0b6b32e5270523a09c0766d31bb9c9721d (patch) | |
tree | 7ea7daede27b9d93ec0bbaa8b5aff8f892871483 /lib/Support/Unix/Path.inc | |
parent | 161e3a80b2c50b3418321d82bb746d7d4738f888 (diff) | |
download | llvm-bd3f9c0b6b32e5270523a09c0766d31bb9c9721d.tar.gz llvm-bd3f9c0b6b32e5270523a09c0766d31bb9c9721d.tar.bz2 llvm-bd3f9c0b6b32e5270523a09c0766d31bb9c9721d.tar.xz |
[Support/FileSystem] Introduce llvm::sys::fs::create_symbolic_link().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203136 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Unix/Path.inc')
-rw-r--r-- | lib/Support/Unix/Path.inc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index caa30c7533..fe3f43a6fd 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -285,6 +285,19 @@ error_code create_hard_link(const Twine &to, const Twine &from) { return error_code::success(); } +error_code create_symbolic_link(const Twine &to, const Twine &from) { + // Get arguments. + SmallString<128> from_storage; + SmallString<128> to_storage; + StringRef f = from.toNullTerminatedStringRef(from_storage); + StringRef t = to.toNullTerminatedStringRef(to_storage); + + if (::symlink(t.begin(), f.begin()) == -1) + return error_code(errno, system_category()); + + return error_code::success(); +} + error_code remove(const Twine &path, bool IgnoreNonExisting) { SmallString<128> path_storage; StringRef p = path.toNullTerminatedStringRef(path_storage); |