ソースを参照

Merge pull request #225 from alamb3142/main

Support for Windows Hidden Files
Christina Sørensen 2 年 前
コミット
e00654b7ac
1 ファイル変更16 行追加3 行削除
  1. 16 3
      src/fs/dir.rs

+ 16 - 3
src/fs/dir.rs

@@ -129,11 +129,24 @@ impl<'dir, 'ig> Files<'dir, 'ig> {
                     }
                 }
 
-                return Some(File::from_args(path.clone(), self.dir, filename, self.deref_links)
-                                 .map_err(|e| (path.clone(), e)))
+                let file = File::from_args(
+                    path.clone(),
+                    self.dir,
+                    filename,
+                    self.deref_links
+                ).map_err(|e| (path.clone(), e));
+
+                // Windows has its own concept of hidden files, with a flag
+                // stored in the file's attributes
+                #[cfg(windows)]
+                if !self.dotfiles && file.as_ref().is_ok_and(|f| f.attributes().hidden) {
+                    continue;
+                }
+
+                return Some(file);
             }
 
-            return None
+            return None;
         }
     }
 }