Skip to content

Commit

Permalink
Fix error in NotHidden::feed on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
olson-sean-k committed Nov 27, 2023
1 parent 5a5babb commit 6bd4c85
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/walk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -958,10 +958,10 @@ where
.filter_tree_by_substituent(
WalkCancellation::unchecked(&mut self.input),
|substituent| {
substituent.metadata().and_then(|metadata| {
substituent.metadata().ok().and_then(|metadata| {
((metadata.file_attributes() & FILE_ATTRIBUTE_HIDDEN)
== FILE_ATTRIBUTE_HIDDEN)
.then_some(EntryResidue::Tree)
.then_some(TreeResidue::Tree(()))
})
},
)
Expand Down Expand Up @@ -1073,11 +1073,11 @@ mod tests {
.encode_wide()
.chain(Some(0))
.collect();
if 0 != unsafe { fileapi::SetFileAttributesW(path.as_ptr(), FILE_ATTRIBUTE_HIDDEN) } {
Ok(())
if 0 == unsafe { fileapi::SetFileAttributesW(path.as_ptr(), FILE_ATTRIBUTE_HIDDEN) } {
Err(io::Error::last_os_error())
}
else {
Err(io::Error::last_os_error())
Ok(())
}
}

Expand Down Expand Up @@ -1222,8 +1222,8 @@ mod tests {
);
}

#[cfg(any(unix, windows))]
#[test]
#[cfg(any(unix, windows))]
fn walk_tree_with_not_hidden() {
let (_root, path) = temptree();

Expand Down

0 comments on commit 6bd4c85

Please sign in to comment.