From 6ef22654916b707ebffdcfefbadf48f88ba56f8b Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Sat, 13 Jan 2024 17:58:44 -0800 Subject: [PATCH] Copy progress bar needs the total amount of data copied Partly fixes #227 --- src/console.rs | 1 - src/copy_tree.rs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/console.rs b/src/console.rs index 402362da..8a71d1a4 100644 --- a/src/console.rs +++ b/src/console.rs @@ -555,7 +555,6 @@ impl CopyModel { /// Update that some bytes have been copied. /// /// `bytes_copied` is the total bytes copied so far. - #[allow(dead_code)] fn bytes_copied(&mut self, bytes_copied: u64) { self.bytes_copied = bytes_copied } diff --git a/src/copy_tree.rs b/src/copy_tree.rs index 5c6698b7..ab2647da 100644 --- a/src/copy_tree.rs +++ b/src/copy_tree.rs @@ -80,7 +80,7 @@ pub fn copy_tree( })?; total_bytes += bytes_copied; total_files += 1; - console.copy_progress(bytes_copied); + console.copy_progress(total_bytes); } else if ft.is_dir() { std::fs::create_dir_all(&dest_path) .with_context(|| format!("Failed to create directory {dest_path:?}"))?;