Skip to content

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.

Archive tests keep their folders under one parent and sweep old ones

gelenmedyabe8f210c9ad1
diff --git a/crates/rf-archive/src/lib.rs b/crates/rf-archive/src/lib.rs
index c4d1d4e5..922d0a91 100644
--- a/crates/rf-archive/src/lib.rs
+++ b/crates/rf-archive/src/lib.rs
@@ -1826,8 +1826,21 @@ mod tests {
static N: AtomicU32 = AtomicU32::new(0);
+ /// A fresh folder for a test, under one parent of the tests' own. The trees are not removed by the tests that make them (870
+ /// `rf-archive-only-*` and 1730 `rf-archive-src-*` folders had piled up in %TEMP% by 2026-12-02), so the first call of a run
+ /// removes those an earlier run left: every folder there older than an hour.
fn tmp(tag: &str) -> PathBuf {
- let d = std::env::temp_dir().join(format!("rf-archive-{tag}-{}-{}", std::process::id(), N.fetch_add(1, Ordering::Relaxed)));
+ static SWEEP: std::sync::Once = std::sync::Once::new();
+ let base = std::env::temp_dir().join("rf-archive-tests");
+ SWEEP.call_once(|| {
+ for e in fs::read_dir(&base).into_iter().flatten().flatten() {
+ let old = e.metadata().and_then(|m| m.modified()).ok().and_then(|t| t.elapsed().ok()).is_some_and(|a| a.as_secs() > 3600);
+ if old {
+ let _ = fs::remove_dir_all(e.path());
+ }
+ }
+ });
+ let d = base.join(format!("{tag}-{}-{}", std::process::id(), N.fetch_add(1, Ordering::Relaxed)));
let _ = fs::remove_dir_all(&d);
fs::create_dir_all(&d).unwrap();
d