Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/walkdir.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-02-02 06:49:59 +0300
committerAndrew Gallant <jamslam@gmail.com>2018-02-02 06:49:59 +0300
commitdc4c1ccea153419b92d41787fa34009dfa2f85e1 (patch)
tree793b71bac5cb39eeb0f45305fc7b4eb83dd0375d
parent01ee572ab49984b31874274d781f63ae80a31045 (diff)
windows: use entry file type
Using fs::metadata will always read through a link, and we want to preserve the type of the original entry.
-rw-r--r--src/lib.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 254e85a..a97aecf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1059,12 +1059,15 @@ impl DirEntry {
#[cfg(not(unix))]
fn from_entry(depth: usize, ent: &fs::DirEntry) -> Result<DirEntry> {
let path = ent.path();
+ let ty = ent.file_type().map_err(|err| {
+ Error::from_path(depth, path.clone(), err)
+ })?;
let md = fs::metadata(&path).map_err(|err| {
Error::from_path(depth, path.clone(), err)
})?;
Ok(DirEntry {
path: path,
- ty: md.file_type(),
+ ty: ty,
follow_link: false,
depth: depth,
metadata: md,