From e2f70a1215ffce5524c9e59cd14bbd172084e0ea Mon Sep 17 00:00:00 2001 From: Frederic Laing Date: Wed, 12 Nov 2025 23:12:12 +0100 Subject: [PATCH] fix for hidden files being visible on external drives --- src/mounter/gvfs.rs | 19 ++++++++++++++++++- src/tab.rs | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/mounter/gvfs.rs b/src/mounter/gvfs.rs index 4d2a44d..dcb7327 100644 --- a/src/mounter/gvfs.rs +++ b/src/mounter/gvfs.rs @@ -85,6 +85,18 @@ fn network_scan(uri: &str, sizes: IconSizes) -> Result, String> { } } + // Read .hidden file if present + let hidden_files: Box<[String]> = if let Some(path) = file.path() { + let hidden_file_path = path.join(".hidden"); + if hidden_file_path.is_file() { + tab::parse_hidden_file(&hidden_file_path) + } else { + Box::from([]) + } + } else { + Box::from([]) + }; + let mut items = Vec::new(); for info_res in file .enumerate_children("*", gio::FileQueryInfoFlags::NONE, gio::Cancellable::NONE) @@ -155,12 +167,17 @@ fn network_scan(uri: &str, sizes: IconSizes) -> Result, String> { ) }; + // Check if item is hidden + let hidden = name.starts_with('.') + || info.boolean(gio::FILE_ATTRIBUTE_STANDARD_IS_HIDDEN) + || hidden_files.contains(&name); + items.push(tab::Item { name, is_mount_point: false, display_name, metadata, - hidden: false, + hidden, location_opt: Some(location), mime, icon_handle_grid, diff --git a/src/tab.rs b/src/tab.rs index 98f7738..f3d97d3 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -2531,7 +2531,7 @@ fn folder_name>(path: P) -> (String, bool) { } // parse .hidden file and return files path -fn parse_hidden_file(path: &PathBuf) -> Box<[String]> { +pub fn parse_hidden_file(path: &PathBuf) -> Box<[String]> { let Ok(file) = File::open(path) else { return Default::default(); };