From 001b6f13676bd8f7195e00342dc5af099c9554c1 Mon Sep 17 00:00:00 2001 From: Xtr126 Date: Thu, 24 Oct 2024 10:46:32 +0530 Subject: [PATCH] fix: Don't exceed 100% of progress on Windows --- src-tauri/src/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 55e36ee..576461f 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -158,15 +158,19 @@ fn start_install( let window_ = window.clone(); - // We cant determine progress on windows by checking size + // We can't determine progress on windows by checking size #[cfg(windows)] thread::spawn(move || { let mut progress = 1; loop { progress = progress + 1; // 100 should be sent only from the other thread - if progress != 100 { window.emit("new-dir-size", progress).unwrap(); } - thread::sleep(time::Duration::from_secs(1)); + if progress != 100 { + window.emit("new-dir-size", progress).unwrap(); + thread::sleep(time::Duration::from_secs(1)); + } else { + break; + } } });