diff options
author | Piotr Wach <pwach@bloomberg.net> | 2024-01-14 22:08:26 +0000 |
---|---|---|
committer | Piotr Wach <pwach@bloomberg.net> | 2024-01-14 22:08:26 +0000 |
commit | 99e53849dd6096d05ab4962e1ed5440efcae83f3 (patch) | |
tree | 6609eef4efa504f1727863de587eb0f30e7f9210 /src/traverse.rs | |
parent | c3d665d40264c819be66a5e290a87fb9f2007cf8 (diff) |
Preserve selected element after refresh
Diffstat (limited to 'src/traverse.rs')
-rw-r--r-- | src/traverse.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/traverse.rs b/src/traverse.rs index 0bb16d7..1651195 100644 --- a/src/traverse.rs +++ b/src/traverse.rs @@ -172,6 +172,7 @@ pub struct BackgroundTraversal { inodes: InodeFilter, throttle: Option<Throttle>, skip_root: bool, + use_root_path: bool, pub event_rx: Receiver<TraversalEvent>, } @@ -183,6 +184,7 @@ impl BackgroundTraversal { walk_options: &WalkOptions, input: Vec<PathBuf>, skip_root: bool, + use_root_path: bool, ) -> anyhow::Result<BackgroundTraversal> { let (entry_tx, entry_rx) = crossbeam::channel::bounded(100); std::thread::Builder::new() @@ -238,6 +240,7 @@ impl BackgroundTraversal { inodes: InodeFilter::default(), throttle: Some(Throttle::new(Duration::from_millis(250), None)), skip_root, + use_root_path, event_rx: entry_rx, }) } @@ -264,7 +267,7 @@ impl BackgroundTraversal { entry.depth -= 1; data.name = entry.file_name.into() } else { - data.name = if entry.depth < 1 { + data.name = if entry.depth < 1 && self.use_root_path { (*root_path).clone() } else { entry.file_name.into() |