Skip to content

Commit

Permalink
Added follow parameter judgment in NewerMatcher.
Browse files Browse the repository at this point in the history
  • Loading branch information
hanbings committed Jul 31, 2024
1 parent ca126d5 commit 4092697
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/find/matchers/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ pub struct NewerMatcher {

impl NewerMatcher {
pub fn new(path_to_file: &str, follow: bool) -> Result<Self, Box<dyn Error>> {
let metadata = fs::metadata(path_to_file)?;
let metadata = if follow {
fs::symlink_metadata(path_to_file)?
} else {
fs::metadata(path_to_file)?
};
Ok(Self {
given_modification_time: metadata.modified()?,
follow,
Expand Down

0 comments on commit 4092697

Please sign in to comment.