diff options
author | fxqnlr <[email protected]> | 2024-09-08 22:30:05 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2024-09-08 22:30:05 +0200 |
commit | 9a34651063029394845a3e18fe7afd5b7c4db777 (patch) | |
tree | 3e7132b7b39d95b39d3827fac3bb12efe372391e /src/backup.rs | |
parent | 4b9514f364f1711555208bd4b9316e7d5c597dc5 (diff) | |
download | arbs-9a34651063029394845a3e18fe7afd5b7c4db777.tar arbs-9a34651063029394845a3e18fe7afd5b7c4db777.tar.gz arbs-9a34651063029394845a3e18fe7afd5b7c4db777.zip |
folder last modified reflects newest child
Diffstat (limited to 'src/backup.rs')
-rw-r--r-- | src/backup.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backup.rs b/src/backup.rs index a643cb2..675f020 100644 --- a/src/backup.rs +++ b/src/backup.rs | |||
@@ -20,7 +20,7 @@ pub type BackupId = String; | |||
20 | #[derive(Debug, Serialize, Deserialize)] | 20 | #[derive(Debug, Serialize, Deserialize)] |
21 | pub struct Backup { | 21 | pub struct Backup { |
22 | pub id: String, | 22 | pub id: String, |
23 | timestamp: u64, | 23 | pub timestamp: u64, |
24 | packages: Vec<Package>, | 24 | packages: Vec<Package>, |
25 | pub files: Vec<PathInfo>, | 25 | pub files: Vec<PathInfo>, |
26 | device: String, | 26 | device: String, |
@@ -74,16 +74,16 @@ impl Backup { | |||
74 | 74 | ||
75 | Ok(Some(Self::from_index( | 75 | Ok(Some(Self::from_index( |
76 | config, | 76 | config, |
77 | list.last().ok_or(Error::BackupNotFound)?.id.clone(), | 77 | &list.last().ok_or(Error::BackupNotFound)?.id, |
78 | )?)) | 78 | )?)) |
79 | } | 79 | } |
80 | 80 | ||
81 | pub fn from_index(config: &Config, id: BackupId) -> Result<Self> { | 81 | pub fn from_index(config: &Config, id: &BackupId) -> Result<Self> { |
82 | let backup_index_root = format!("{}/index.json", config.root); | 82 | let backup_index_root = format!("{}/index.json", config.root); |
83 | let list: Vec<BackupLocation> = Self::get_json_content(&backup_index_root)?; | 83 | let list: Vec<BackupLocation> = Self::get_json_content(&backup_index_root)?; |
84 | let index_loc = list | 84 | let index_loc = list |
85 | .iter() | 85 | .iter() |
86 | .find(|bl| bl.id == id) | 86 | .find(|bl| &bl.id == id) |
87 | .ok_or(Error::BackupNotFound)? | 87 | .ok_or(Error::BackupNotFound)? |
88 | .rel_location | 88 | .rel_location |
89 | .clone(); | 89 | .clone(); |