[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
This commit is contained in:
Argyrios Kyrtzidis
2014-03-06 17:36:46 +00:00
parent 161e3a80b2
commit bd3f9c0b6b
3 changed files with 40 additions and 0 deletions

View File

@@ -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);