refactor: properly cleanup unused binaries and simplify downloaded browser registry

This commit is contained in:
zhom
2025-07-26 18:27:38 +04:00
parent 328e6f16ee
commit df78e22650
4 changed files with 94 additions and 101 deletions
+6 -3
View File
@@ -370,12 +370,15 @@ impl AutoUpdater {
let mut registry = crate::downloaded_browsers::DownloadedBrowsersRegistry::load()
.map_err(|e| format!("Failed to load browser registry: {e}"))?;
// Get active browser versions
// Get active browser versions (all profiles)
let active_versions = registry.get_active_browser_versions(&profiles);
// Cleanup unused binaries
// Get running browser versions (only running profiles)
let running_versions = registry.get_running_browser_versions(&profiles);
// Cleanup unused binaries (but keep running ones)
let cleaned_up = registry
.cleanup_unused_binaries(&active_versions)
.cleanup_unused_binaries(&active_versions, &running_versions)
.map_err(|e| format!("Failed to cleanup unused binaries: {e}"))?;
// Save updated registry