don't set permissions if they're already the same

master
rascul 5 years ago
parent ddfd04872b
commit 5fbef7333b

@ -38,8 +38,6 @@ fn copy_dir(src: &PathBuf, dst: &PathBuf, verbose: bool) -> MkrootResult<()> {
copy_file(&entry_path, &new_dst)?;
}
} else if entry_path.is_dir() {
let perms = get_perms(&entry_path)?;
if !new_dst.exists() {
if verbose {
println!("Creating directory {}", &new_dst.display());
@ -53,14 +51,20 @@ fn copy_dir(src: &PathBuf, dst: &PathBuf, verbose: bool) -> MkrootResult<()> {
)));
}
if verbose {
println!(
"Setting permissions {:o} on {}",
&perms.mode(),
&new_dst.display()
);
let entry_perms = get_perms(&entry_path)?;
let dst_perms = get_perms(&new_dst)?;
if entry_perms != dst_perms {
if verbose {
println!(
"Setting permissions {:o} on {}",
&entry_perms.mode(),
&new_dst.display()
);
}
set_perms(&new_dst, entry_perms)?;
}
set_perms(&new_dst, perms)?;
copy_dir(&entry_path, &new_dst, verbose)?;
}

Loading…
Cancel
Save