0uo
This commit is contained in:
parent
e3466a8912
commit
9be33cd90f
1 changed files with 2 additions and 3 deletions
|
@ -61,11 +61,10 @@ impl Display for ScanError {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
fn is_hidden(entry: &DirEntry) -> bool {
|
fn is_hidden(entry: &DirEntry) -> bool {
|
||||||
use std::os::windows::prelude::*;
|
use std::os::windows::prelude::*;
|
||||||
use std::fs;
|
std::fs::metadata(entry) // try to get metadata for file
|
||||||
fs::metadata(entry) // try to get metadata for file
|
|
||||||
.map_or(
|
.map_or(
|
||||||
false, // if getting metadata/attributes fails, assume it's not hidden
|
false, // if getting metadata/attributes fails, assume it's not hidden
|
||||||
|f| f.file_attributes() & 0x2 // flag for hidden - https://docs.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
|
|f| f.file_attributes() & 0x2 > 0 // flag for hidden - https://docs.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue