From 912350743a7e6e5dbc7bd4ba7b220a35b9d9cc09 Mon Sep 17 00:00:00 2001 From: Philip Kristoffersen Date: Fri, 1 Apr 2022 18:06:27 +0200 Subject: [PATCH] Only add installed heroic games --- src/heroic/heroic_game.rs | 6 ++++++ src/heroic/heroic_platform.rs | 1 + 2 files changed, 7 insertions(+) diff --git a/src/heroic/heroic_game.rs b/src/heroic/heroic_game.rs index 32ccba0..4e6bb68 100644 --- a/src/heroic/heroic_game.rs +++ b/src/heroic/heroic_game.rs @@ -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 for ShortcutOwned { fn from(game: HeroicGame) -> Self { let target_path = Path::new(&game.install_path).join(game.executable); diff --git a/src/heroic/heroic_platform.rs b/src/heroic/heroic_platform.rs index 9e54d0c..492f1ec 100644 --- a/src/heroic/heroic_platform.rs +++ b/src/heroic/heroic_platform.rs @@ -62,6 +62,7 @@ impl Platform> 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));