mirror of
https://github.com/Universal-Debloater-Alliance/universal-android-debloater-next-generation.git
synced 2026-08-09 15:19:11 +02:00
refactor(save): more idiomatic list_available_backup_user
This commit is contained in:
parent
c2614ac892
commit
a7fd492f5a
1 changed files with 10 additions and 14 deletions
|
|
@ -80,20 +80,16 @@ pub fn list_available_backups(dir: &Path) -> Vec<DisplayablePath> {
|
|||
|
||||
pub fn list_available_backup_user(backup: DisplayablePath) -> Vec<User> {
|
||||
match fs::read_to_string(backup.path) {
|
||||
Ok(data) => {
|
||||
let phone_backup: PhoneBackup =
|
||||
serde_json::from_str(&data).expect("Unable to parse backup file");
|
||||
|
||||
let mut users = vec![];
|
||||
for u in phone_backup.users {
|
||||
users.push(User {
|
||||
id: u.id,
|
||||
index: 0,
|
||||
protected: false,
|
||||
});
|
||||
}
|
||||
users
|
||||
}
|
||||
Ok(data) => serde_json::from_str::<PhoneBackup>(&data)
|
||||
.expect("Unable to parse backup file")
|
||||
.users
|
||||
.into_iter()
|
||||
.map(|u| User {
|
||||
id: u.id,
|
||||
index: 0,
|
||||
protected: false,
|
||||
})
|
||||
.collect(),
|
||||
Err(e) => {
|
||||
error!("[BACKUP]: Selected backup file not found: {}", e);
|
||||
vec![]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue