This commit is contained in:
Lynne Megido 2021-02-06 21:53:44 +10:00
parent e3466a8912
commit 9be33cd90f
Signed by: lynnesbian
GPG Key ID: F0A184B5213D9F90

View File

@ -61,11 +61,10 @@ impl Display for ScanError {
#[cfg(windows)]
fn is_hidden(entry: &DirEntry) -> bool {
use std::os::windows::prelude::*;
use std::fs;
fs::metadata(entry) // try to get metadata for file
std::fs::metadata(entry) // try to get metadata for file
.map_or(
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
)
}