Skip to content

Commit

Permalink
Reflink only on supported targets
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Jul 30, 2022
1 parent 80cd00e commit e175a18
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/bins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,26 @@ fn install_copy(src: &Path, dst: &Path) -> Result<(), BinstallError> {
dst.display()
);

debug!("Reflink copy or fallback");
reflink::reflink_or_copy(src, dst)?;
#[cfg(any(
target = "x86_64-unknown-linux-gnu",
target = "x86_64-apple-darwin",
target = "aarch64-apple-darwin",
target = "aarch64-unknown-linux-gnu"
))]
{
debug!("Reflink copy or fallback");
reflink::reflink_or_copy(src, dst)?;
}
#[cfg(not(any(
target = "x86_64-unknown-linux-gnu",
target = "x86_64-apple-darwin",
target = "aarch64-apple-darwin",
target = "aarch64-unknown-linux-gnu"
)))]
{
debug!("Copy file");
fs::copy(src, dst)?;
}

debug!("Copy permissions");
let permissions = fs::File::open(src)?.metadata()?.permissions();
Expand Down

0 comments on commit e175a18

Please sign in to comment.