Only add installed heroic games

This commit is contained in:
Philip Kristoffersen
2022-04-01 18:06:27 +02:00
parent a8e802aa19
commit 912350743a
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -13,6 +13,12 @@ pub struct HeroicGame {
pub launch_parameters: String,
}
impl HeroicGame{
fn is_installed(&self) -> bool{
Path::new(&self.install_path).join(&self.executable).exists()
}
}
impl From<HeroicGame> for ShortcutOwned {
fn from(game: HeroicGame) -> Self {
let target_path = Path::new(&game.install_path).join(game.executable);
+1
View File
@@ -62,6 +62,7 @@ impl Platform<HeroicGame, Box<dyn Error>> for HeroicPlatform {
.iter()
.filter_map(|install_mode| get_shortcuts_from_install_mode(install_mode).ok())
.flatten()
.filter(|s| s.is_installed())
.collect();
shortcuts.sort_by_key(|m| format!("{}-{}-{}",m.launch_parameters,m.executable,&m.app_name));