From bcb76a036a358bfe07449859663e4e8379186556 Mon Sep 17 00:00:00 2001 From: Jay Date: Wed, 17 Jun 2020 14:38:40 +0100 Subject: [PATCH] update windows FileType --- src/meta/filetype.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/meta/filetype.rs b/src/meta/filetype.rs index 016b05c..82fa649 100644 --- a/src/meta/filetype.rs +++ b/src/meta/filetype.rs @@ -54,7 +54,11 @@ impl FileType { } #[cfg(windows)] - pub fn new(meta: &Metadata, symlink_is_dir: Option, permissions: &Permissions) -> Self { + pub fn new( + meta: &Metadata, + symlink_meta: Option<&Metadata>, + permissions: &Permissions, + ) -> Self { let file_type = meta.file_type(); if file_type.is_file() { @@ -68,7 +72,8 @@ impl FileType { } } else if file_type.is_symlink() { FileType::SymLink { - is_dir: symlink_is_dir.expect("symlink must provide is_dir"), + // if broken, defaults to false + is_dir: symlink_meta.map(|m| m.is_dir()).unwrap_or_default(), } } else { FileType::Special