A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.
Rust archive-managerdesktop-appdual-paneexplorer-alternativefile-browserfile-explorerfile-managerfluent-designgpu-acceleratedgpuimacosmicaproductivityquick-lookrustrust-guitabswindowswindows-11windows-explorer
HyperSearch: cloud drives are walked again now and then, like shares
M0rs-latumcac307573434
diff --git a/crates/rf-win/src/indexer.rs b/crates/rf-win/src/indexer.rsindex cb4df654..60bf1d6d 100644--- a/crates/rf-win/src/indexer.rs+++ b/crates/rf-win/src/indexer.rs@@ -43,6 +43,10 @@ struct Slot {/// A network share (SMB): walked like any root, but its watcher is not to be trusted — a/// re-walk keeps it honest (see [`follow`]).network: bool,+ /// A cloud drive (Google Drive for desktop and the like): a fixed, internal volume with no+ /// change journal. Its watcher misses what changed on the other side (a file added on the+ /// web or another PC), so it is walked again now and then, like a share.+ cloud: bool,/// A re-walk of a network root is running on a thread of its own.rescanning: AtomicBool,}@@ -115,6 +119,7 @@ pub fn start(roots: Vec<PathBuf>, dir: PathBuf) {let journaled = crate::usn::query(&root).is_some();let spinning = crate::drives::seek_penalty(&root) == Some(true);let network = crate::drives::is_network_path(&root);+ let cloud = !journaled && !network && is_cloud_drive(&root);let slot = Arc::new(Slot {file: file_for(&dir, &root),root,@@ -125,6 +130,7 @@ pub fn start(roots: Vec<PathBuf>, dir: PathBuf) {journaled,spinning,network,+ cloud,rescanning: AtomicBool::new(false),});// NTFS: the change journal says which folders changed, once a second (cheaper than a@@ -269,7 +275,7 @@ fn follow(slot: Arc<Slot>, cancel: &Arc<AtomicBool>) {// a while the root is walked again on a thread of its own, so a forgotten rename or a// dropped watch does not grow into a stale index. The index on hand keeps answering// searches meanwhile, and an empty walk (the share away) changes nothing.- let rescan_period = slot.network.then_some(RESCAN_NETWORK);+ let rescan_period = (slot.network || slot.cloud).then_some(RESCAN_NETWORK);let mut last_rescan = Instant::now();// The journal position one round ago: by now the watcher has reported every change// before it and the folders were listed again, so the saved index is current up to there@@ -411,6 +417,17 @@ pub fn roots_for_letters(letters: &[String]) -> Vec<PathBuf> {.collect()}+/// A fixed, internal drive that is neither NTFS nor ReFS: on a PC that is a virtual cloud drive+/// (Google Drive for desktop mounts as FAT32), not a disk. Listing its folders reads names only,+/// so a walk downloads no file.+fn is_cloud_drive(root: &Path) -> bool {+ crate::drives::list_drives().iter().any(|d| d.root == root && looks_like_cloud(d))+}++fn looks_like_cloud(d: &crate::drives::Drive) -> bool {+ d.kind == crate::drives::DriveKind::Fixed && !d.external && !d.fs.is_empty() && !matches!(d.fs.to_ascii_uppercase().as_str(), "NTFS" | "REFS")+}+pub fn running() -> bool {service().lock().is_some()}@@ -460,6 +477,24 @@ fn follow_journal(slot: &Slot, cancel: &AtomicBool) {mod tests {use super::*;+ fn drive(kind: crate::drives::DriveKind, fs: &str, external: bool) -> crate::drives::Drive {+ crate::drives::Drive { root: PathBuf::from("G:\\"), letter: 'G', label: String::new(), kind, total: 0, free: 0, fs: fs.into(), external }+ }++ /// Google Drive for desktop mounts as a fixed FAT32 volume: it is re-walked now and then. A disk (NTFS, ReFS), a USB stick or+ /// disk, and a share are not: a disk has its journal, and re-walking a USB disk would wake it for nothing.+ #[test]+ fn only_an_internal_fixed_volume_without_ntfs_counts_as_a_cloud_drive() {+ use crate::drives::DriveKind::*;+ assert!(looks_like_cloud(&drive(Fixed, "FAT32", false)));+ assert!(!looks_like_cloud(&drive(Fixed, "NTFS", false)));+ assert!(!looks_like_cloud(&drive(Fixed, "ReFS", false)));+ assert!(!looks_like_cloud(&drive(Fixed, "exFAT", true)));+ assert!(!looks_like_cloud(&drive(Removable, "FAT32", false)));+ assert!(!looks_like_cloud(&drive(Network, "NTFS", false)));+ assert!(!looks_like_cloud(&drive(Fixed, "", false)));+ }+/// A start whose saved index can be caught up from the change journal must get through: it caught up, saved the index and went on/// following the drive. (It used to wait for itself for ever.)#[test]@@ -488,6 +523,7 @@ mod tests {journaled: true,spinning: false,network: false,+ cloud: false,rescanning: AtomicBool::new(false),});let cancel = Arc::new(AtomicBool::new(false));