Skip to content

Commit 521eb54

Browse files
committed
Do not try to fix non BoilR shortcut icons
1 parent 06de2bd commit 521eb54

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

src/sync/synchronization.rs

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,22 @@ pub async fn download_images(settings: &Settings, userinfo_shortcuts: &Vec<Steam
106106
}
107107
}
108108

109+
trait IsBoilRShortcut{
110+
fn is_boilr_tag(&self) -> bool;
111+
}
112+
113+
impl IsBoilRShortcut for ShortcutOwned{
114+
fn is_boilr_tag(&self) -> bool {
115+
let boilr_tag = BOILR_TAG.to_string();
116+
self.tags.contains(&boilr_tag) || self.dev_kit_game_id.starts_with(&boilr_tag)
117+
}
118+
}
119+
120+
109121
fn remove_old_shortcuts(shortcut_info: &mut ShortcutInfo) {
110-
let boilr_tag = BOILR_TAG.to_string();
111122
shortcut_info
112123
.shortcuts
113-
.retain(|shortcut| !shortcut.tags.contains(&boilr_tag));
114-
shortcut_info
115-
.shortcuts
116-
.retain(|shortcut| !shortcut.dev_kit_game_id.starts_with(&boilr_tag));
124+
.retain(|shortcut| !shortcut.is_boilr_tag());
117125
}
118126

119127
fn fix_shortcut_icons(
@@ -130,14 +138,16 @@ fn fix_shortcut_icons(
130138
ImageType::Icon
131139
};
132140

133-
for shortcut in shortcuts {
134-
let replace_icon = shortcut.icon.trim().eq("") || !Path::new(shortcut.icon.trim()).exists() || shortcut.icon.eq(&shortcut.exe);
135-
if replace_icon {
136-
let app_id = steam_shortcuts_util::app_id_generator::calculate_app_id(
137-
&shortcut.exe,
138-
&shortcut.app_name,
139-
);
140-
shortcut.icon = image_folder.join(image_type.file_name(app_id)).to_string_lossy().to_string();
141+
for shortcut in shortcuts {
142+
if shortcut.is_boilr_tag(){
143+
let replace_icon = shortcut.icon.trim().eq("") || !Path::new(shortcut.icon.trim()).exists() || shortcut.icon.eq(&shortcut.exe);
144+
if replace_icon {
145+
let app_id = steam_shortcuts_util::app_id_generator::calculate_app_id(
146+
&shortcut.exe,
147+
&shortcut.app_name,
148+
);
149+
shortcut.icon = image_folder.join(image_type.file_name(app_id)).to_string_lossy().to_string();
150+
}
141151
}
142152
}
143153
}

0 commit comments

Comments
 (0)