fn copy_and_sync_file(
    log: &ReplicaLogger,
    src: &Path,
    dst: &Path,
    dst_permissions: FilePermissions,
) -> std::io::Result<()> {
    do_copy(log, src, dst)?;

    // We keep the directory writable though to make sure we can rename
    // them or delete the files.
    let dst_metadata = dst.metadata()?;
    let mut permissions = dst_metadata.permissions();
    match dst_permissions {
        FilePermissions::ReadOnly => permissions.set_readonly(true),
        FilePermissions::ReadWrite => permissions.set_readonly(false),
    }
    fs::set_permissions(&dst, permissions)?;
    sync_path(&dst)
}
/// Copies the given file and ensures that the `read/write` permission of the
/// target file match the given permission.
Copies the given file and ensures that the `read/write` permission of the
target file match the given permission.
Copies the given file and ensures that the ` read / write ` permission of the target file match the given permission .
fn copy_and_sync_file(
    log: &ReplicaLogger,
    src: &Path,
    dst: &Path,
    dst_permissions: FilePermissions,
) -> std::io::Result<()> {
    do_copy(log, src, dst)?;
    // We keep the directory writable though to make sure we can rename
    // them or delete the files.
    let dst_metadata = dst.metadata()?;
    let mut permissions = dst_metadata.permissions();
    match dst_permissions {
        FilePermissions::ReadOnly => permissions.set_readonly(true),
        FilePermissions::ReadWrite => permissions.set_readonly(false),
    }
    fs::set_permissions(&dst, permissions)?;
    sync_path(&dst)
}
fn copy_and_sync_file ( log : & ReplicaLogger , src : & Path , dst : & Path , dst_permissions : FilePermissions , ) -> std :: io :: Result < ( ) > { do_copy ( log , src , dst ) ? ; // We keep the directory writable though to make sure we can rename // them or delete the files. let dst_metadata = dst . metadata ( ) ? ; let mut permissions = dst_metadata . permissions ( ) ; match dst_permissions { FilePermissions :: ReadOnly => permissions . set_readonly ( true ) , FilePermissions :: ReadWrite => permissions . set_readonly ( false ) , } fs :: set_permissions ( & dst , permissions ) ? ; sync_path ( & dst ) }
Copies the given file and ensures that the `read/write` permission of the
target file match the given permission.
Copies the given file and ensures that the ` read / write ` permission of the target file match the given permission .
log
&ReplicaLogger
src
&Path
dst
&Path
dst_permissions
FilePermissions
log
&ReplicaLogger
src
&Path
dst
&Path
dst_permissions
FilePermissions