Add portable mode with removable media detection and scanning

This commit is contained in:
lashman
2026-02-28 00:16:52 +02:00
parent f2abfba753
commit 2108b0f3d8
8 changed files with 138 additions and 1 deletions

View File

@@ -1058,6 +1058,17 @@ impl DriftwoodWindow {
dirs.push(system_dir.to_string());
}
// Include removable media mount points if enabled
if settings.boolean("watch-removable-media") {
for mount in crate::core::portable::detect_removable_mounts() {
let mp = mount.mount_point.to_string_lossy().to_string();
if !dirs.iter().any(|d| d == &mp) {
log::info!("Including removable mount: {} ({}, {})", mp, mount.device, mount.fs_type);
dirs.push(mp);
}
}
}
let toast_overlay = self.imp().toast_overlay.get().unwrap().clone();
let window_weak = self.downgrade();
@@ -1121,6 +1132,15 @@ impl DriftwoodWindow {
new_count += 1;
}
// Detect portable/removable media
if crate::core::portable::is_path_on_removable(&d.path) {
let mounts = crate::core::portable::detect_removable_mounts();
let mount_point = mounts.iter()
.find(|m| d.path.starts_with(&m.mount_point))
.map(|m| m.mount_point.to_string_lossy().to_string());
bg_db.set_portable(id, true, mount_point.as_deref()).ok();
}
// Mark for background analysis
bg_db.update_analysis_status(id, "pending").ok();
needs_analysis.push((id, d.path.clone(), d.appimage_type.clone()));