mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
Handle broken utimes() on Android
Closes https://github.com/ankidroid/Anki-Android/issues/12827 Closes https://github.com/ankidroid/Anki-Android/issues/12974
This commit is contained in:
parent
272d53079f
commit
4c5a2461d0
1 changed files with 7 additions and 1 deletions
|
@ -349,7 +349,13 @@ where
|
||||||
.duration_since(time::UNIX_EPOCH)
|
.duration_since(time::UNIX_EPOCH)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.as_secs() as i64;
|
.as_secs() as i64;
|
||||||
utime::set_file_times(&dst_path, secs, secs)?;
|
if let Err(err) = utime::set_file_times(&dst_path, secs, secs) {
|
||||||
|
// The libc utimes() call fails on (some? all?) Android devices. Since we don't
|
||||||
|
// do automatic expiry yet, we can safely ignore the error.
|
||||||
|
if !cfg!(target_os = "android") {
|
||||||
|
return Err(err.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Reference in a new issue