feat: implement check_outdated
This commit is contained in:
parent
b6f3d7697d
commit
97ea2762b2
1 changed files with 12 additions and 1 deletions
13
src/main.rs
13
src/main.rs
|
@ -61,5 +61,16 @@ fn get_dist_path(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_outdated(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> bool {
|
fn check_outdated(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> bool {
|
||||||
true // TODO
|
let up_to_date = dst
|
||||||
|
.as_ref()
|
||||||
|
.metadata()
|
||||||
|
.and_then(|meta| meta.modified())
|
||||||
|
.is_ok_and(|dst_mtime| {
|
||||||
|
src.as_ref()
|
||||||
|
.metadata()
|
||||||
|
.and_then(|meta| meta.modified())
|
||||||
|
.is_ok_and(|src_mtime| src_mtime <= dst_mtime)
|
||||||
|
});
|
||||||
|
// either we cannot get metadata or src_mtime > dst_mtime (outdated)
|
||||||
|
!up_to_date
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue