add modification time fallback if birth time is not supported on this platform

This commit is contained in:
slonkazoid 2024-05-21 11:36:35 +03:00 committed by June 🍓🦴
parent 9eb0784f6f
commit ae1a4fd283
1 changed files with 8 additions and 1 deletions

View File

@ -251,7 +251,14 @@ impl Service {
let file_metadata = fs::metadata(path.clone()).await?;
debug!("File metadata: {:?}", file_metadata);
let file_created_at = file_metadata.created()?;
let file_created_at = match file_metadata.created() {
Ok(value) => value,
Err(err) if err.kind() == std::io::ErrorKind::Unsupported => {
debug!("btime is unsupported, using mtime instead");
file_metadata.modified()?
},
Err(err) => return Err(err.into()),
};
debug!("File created at: {:?}", file_created_at);
if file_created_at >= user_duration {