From ae1a4fd2835b8d9576a2f1528b1cc051ce90d0f3 Mon Sep 17 00:00:00 2001 From: slonkazoid Date: Tue, 21 May 2024 11:36:35 +0300 Subject: [PATCH] add modification time fallback if birth time is not supported on this platform --- src/service/media/mod.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/service/media/mod.rs b/src/service/media/mod.rs index 73c8e089..5e39085d 100644 --- a/src/service/media/mod.rs +++ b/src/service/media/mod.rs @@ -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 {