Filter files hidden by attribute on MacOS
Open
enhancement
- Dominant language
- Rust
- Stars
- 659
- Forks
- 36
- Avg merge
- 18m
- Merged PRs (30d)
- 2
Description
I opened a PR on ripgrep https://github.com/BurntSushi/ripgrep/pull/1557 to add a `filter_entry` method to `ignore::WalkBuilder`. Once that lands we can go back to filtering files hidden by attribute on MacOS. An improved implementation of that, without needing `unsafe` or `libc::stat` is:
```rust
fn hidden(path: &Path) -> Result {
use std::os::macos::fs::MetadataExt;
let metadata = path.metadata().context(error::Filesystem { path })?;
const HIDDEN_MASK_MAC: u32 = 0x0000_8000;
Ok(metadata.st_flags() & HIDDEN_MASK_MAC != 0)
}
```
Contributor guide
Assessment
This issue has not been assessed yet.