Skip to content

Commit

Permalink
Use dev_kit_game_id to identify boilr shortcuts (#49)
Browse files Browse the repository at this point in the history
By using the dev_kit_game_id , steam does not mess with the tags, which should result in a more consistent cleanup of Boilr synchronization.
This should resolve the problem where shortcuts would sometimes get "stuck" and not be removed, and instead show up as duplicates.
  • Loading branch information
PhilipK committed Mar 17, 2022
1 parent fb1ff85 commit e5da7c8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/sync/synchronization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub async fn run_sync(settings: &Settings) -> Result<(), Box<dyn Error>> {
remove_old_shortcuts(&mut shortcut_info);
update_platforms(settings, &mut shortcut_info.shortcuts);
fix_shortcut_icons(user, &mut shortcut_info.shortcuts);
set_dev_kit_game_id_to_boilr( &mut shortcut_info);
save_shortcuts(&shortcut_info.shortcuts, Path::new(&shortcut_info.path));
user.shortcut_path = Some(shortcut_info.path.to_string_lossy().to_string());

Expand All @@ -51,11 +52,21 @@ pub async fn run_sync(settings: &Settings) -> Result<(), Box<dyn Error>> {
Ok(())
}


fn set_dev_kit_game_id_to_boilr(shortcut_info: &mut ShortcutInfo){
shortcut_info.shortcuts.iter_mut().for_each(|shortcut|{
shortcut.dev_kit_game_id = format!("{}{}", BOILR_TAG,shortcut.app_id);
})
}

fn remove_old_shortcuts(shortcut_info: &mut ShortcutInfo) {
let boilr_tag = BOILR_TAG.to_string();
shortcut_info
.shortcuts
.retain(|shortcut| !shortcut.tags.contains(&boilr_tag));
shortcut_info
.shortcuts
.retain(|shortcut| !shortcut.dev_kit_game_id.starts_with(&boilr_tag));
}

fn fix_shortcut_icons(user: &SteamUsersInfo, shortcuts: &mut Vec<ShortcutOwned>) {
Expand Down

0 comments on commit e5da7c8

Please sign in to comment.