LLVM 20.0.0git
|
FilePermssionsApplier helps to copy permissions from an input file to an output one. More...
#include "llvm/Support/FileUtilities.h"
Public Member Functions | |
Error | apply (StringRef OutputFilename, bool CopyDates=false, std::optional< sys::fs::perms > OverwritePermissions=std::nullopt) |
Apply stored permissions to the OutputFilename . | |
Static Public Member Functions | |
static Expected< FilePermissionsApplier > | create (StringRef InputFilename) |
FilePermssionsApplier helps to copy permissions from an input file to an output one.
It memorizes the status of the input file and can apply permissions and dates to the output file.
Definition at line 82 of file FileUtilities.h.
Error FilePermissionsApplier::apply | ( | StringRef | OutputFilename, |
bool | CopyDates = false , |
||
std::optional< sys::fs::perms > | OverwritePermissions = std::nullopt |
||
) |
Apply stored permissions to the OutputFilename
.
Copy LastAccess and ModificationTime if CopyDates
is true. Overwrite stored permissions if OverwritePermissions
is specified.
Definition at line 284 of file FileUtilities.cpp.
References llvm::sys::fs::CD_OpenExisting, llvm::sys::fs::changeFileOwnership(), llvm::createFileError(), llvm::sys::fs::getUmask(), llvm::sys::fs::basic_file_status::getUser(), llvm::sys::fs::openFileForWrite(), OutputFilename, llvm::sys::fs::regular_file, llvm::sys::Process::SafelyCloseFileDescriptor(), llvm::sys::fs::setLastAccessAndModificationTime(), llvm::sys::fs::setPermissions(), llvm::sys::fs::status(), llvm::Error::success(), and llvm::sys::fs::basic_file_status::type().
|
static |
Definition at line 271 of file FileUtilities.cpp.
References llvm::createFileError(), and llvm::sys::fs::status().