Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
Fix backups failing on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
dae committed Jun 27, 2022
1 parent 0a7508f commit 6ff1593
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion rslib/src/collection/backup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@ fn has_recent_backup(backup_folder: &Path, recent_mins: u32) -> Result<bool> {
Ok(read_dir(backup_folder)?
.filter_map(|res| res.ok())
.filter_map(|entry| entry.metadata().ok())
.filter_map(|meta| meta.created().ok())
.filter_map(|meta| {
// created time unsupported on Android
#[cfg(target_os = "android")]
{
meta.modified().ok()
}
#[cfg(not(target_os = "android"))]
{
meta.created().ok()
}
})
.filter_map(|time| now.duration_since(time).ok())
.any(|duration| duration.as_secs() < recent_secs))
}
Expand Down

0 comments on commit 6ff1593

Please sign in to comment.