This commit is contained in:
Julian Freeman
2026-04-16 19:27:48 -04:00
parent e041523dbd
commit c8e1641896

View File

@@ -39,13 +39,7 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
.and_then(|value| value.get("info_cache"))
.and_then(Value::as_object);
let mut profile_ids = BTreeSet::new();
collect_profile_ids_from_fs(&root, &mut profile_ids);
if let Some(cache) = profile_cache {
for profile_id in cache.keys() {
profile_ids.insert(profile_id.to_string());
}
}
let profile_ids = collect_profile_ids_from_local_state(profile_cache);
let mut profiles = Vec::new();
let mut extensions = BTreeMap::<String, TempExtension>::new();
@@ -108,23 +102,12 @@ fn scan_browser(config: BrowserConfigEntry) -> Option<BrowserView> {
})
}
fn collect_profile_ids_from_fs(root: &Path, profile_ids: &mut BTreeSet<String>) {
let Ok(entries) = fs::read_dir(root) else {
return;
};
for entry in entries.flatten() {
let Ok(file_type) = entry.file_type() else {
continue;
};
if !file_type.is_dir() {
continue;
}
let name = entry.file_name().to_string_lossy().to_string();
if name == "Default" || name.starts_with("Profile ") {
profile_ids.insert(name);
}
}
fn collect_profile_ids_from_local_state(
profile_cache: Option<&serde_json::Map<String, Value>>,
) -> BTreeSet<String> {
profile_cache
.map(|cache| cache.keys().cloned().collect())
.unwrap_or_default()
}
fn build_profile_summary(