feat: implement check_outdated

This commit is contained in:
DarkCat09 2024-10-22 16:25:48 +04:00
parent b6f3d7697d
commit 97ea2762b2
Signed by: DarkCat09
GPG key ID: BD3CE9B65916CD82

View file

@ -61,5 +61,16 @@ fn get_dist_path(
}
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
}