Skip to content

Commit

Permalink
Updated ExistedChecker to work in multiple OSes
Browse files Browse the repository at this point in the history
  • Loading branch information
fdncred authored Jun 18, 2020
1 parent a5d1439 commit 37746bd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,19 @@ 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())
.unwrap_or(false)
}
}

pub struct CompositeChecker {
Expand Down

0 comments on commit 37746bd

Please sign in to comment.