diff options
author | Andrew Gallant <jamslam@gmail.com> | 2018-02-02 06:49:59 +0300 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2018-02-02 06:49:59 +0300 |
commit | dc4c1ccea153419b92d41787fa34009dfa2f85e1 (patch) | |
tree | 793b71bac5cb39eeb0f45305fc7b4eb83dd0375d | |
parent | 01ee572ab49984b31874274d781f63ae80a31045 (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.rs | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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, |