Merge pull request #23 from fdncred/patch-1

Allow checker to support reparsepoints in Windows
This commit is contained in:
Harry Fei 2020-06-22 23:12:51 +08:00 committed by GitHub
commit 209804c363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,6 +39,14 @@ impl ExistedChecker {
}
impl Checker for ExistedChecker {
#[cfg(target_os="windows")]
fn is_valid(&self, path: &Path) -> bool {
fs::symlink_metadata(path)
.map(|metadata| metadata.is_file())
.unwrap_or(false)
}
#[cfg(not(target_os="windows"))]
fn is_valid(&self, path: &Path) -> bool {
fs::metadata(path)
.map(|metadata| metadata.is_file())