Add support for getting file system permissions and implement sys::fs::permissions to set them.

Patch by James Henderson.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297617 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Aaron Ballman
2017-03-13 12:17:14 +00:00
parent 61b914021f
commit 565edc0441
5 changed files with 304 additions and 55 deletions
+14 -6
View File
@@ -1189,12 +1189,20 @@ std::error_code identify_magic(const Twine &Path, file_magic &Result) {
}
std::error_code directory_entry::status(file_status &result) const {
return fs::status(Path, result, FollowSymlinks);
}
} // end namespace fs
} // end namespace sys
} // end namespace llvm
return fs::status(Path, result, FollowSymlinks);
}
ErrorOr<perms> getPermissions(const Twine &Path) {
file_status Status;
if (std::error_code EC = status(Path, Status))
return EC;
return Status.permissions();
}
} // end namespace fs
} // end namespace sys
} // end namespace llvm
// Include the truly platform-specific parts.
#if defined(LLVM_ON_UNIX)