Fixed directory copy

This commit is contained in:
Mutzi 2023-01-30 16:33:12 +01:00
parent ad24333d6b
commit cee33671b2

View File

@ -51,7 +51,7 @@ pub fn get_dir_content_filtered(p: &Path, ignored: &[String], pb: &indicatif::Pr
}
pub fn copy_dir(src_dir: &Path, dst_dir: &Path, ignored: &[String], pb: &indicatif::ProgressBar) -> Result<(), String> {
let src_dir_len = src_dir.iter().count();
let src_dir_len = src_dir.canonicalize().unwrap().iter().count();
let trim_fn = |p: PathBuf| {
let new_path = p.into_iter().skip(src_dir_len).collect::<PathBuf>();
(new_path.iter().count() != 0).then_some(new_path).or_else(|| { pb.set_length(pb.length().unwrap() - 1); None })