From 52791fb43f45f2d929396aa1cbe0e36f6c6d433a Mon Sep 17 00:00:00 2001 From: Philip Date: Mon, 21 Mar 2022 22:09:40 +0100 Subject: [PATCH] Fix bug where epic games would doulbe --- src/egs/get_manifests.rs | 8 ++++++-- src/egs/manifest_item.rs | 11 +++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/egs/get_manifests.rs b/src/egs/get_manifests.rs index 3369f01d..2af48451 100644 --- a/src/egs/get_manifests.rs +++ b/src/egs/get_manifests.rs @@ -40,8 +40,11 @@ pub(crate) fn get_egs_manifests( .filter_map(|dir| dir.ok()) .filter_map(get_manifest_item) .filter(is_game_installed) - .filter(is_game_launchable); - Ok(manifests.collect()) + .filter(is_game_launchable); + let mut manifests : Vec = manifests.collect(); + manifests.sort_by_key(|m| format!("{}-{}-{}",m.install_location,m.launch_executable,m.is_managed)); + manifests.dedup_by_key(|m| format!("{}-{}-{}",m.install_location,m.launch_executable,m.is_managed)); + Ok(manifests) } Err(err) => Err(ReadDirError { error: err, @@ -50,6 +53,7 @@ pub(crate) fn get_egs_manifests( } } + fn get_manifest_dir_path( settings: &EpicGamesLauncherSettings, ) -> Result { diff --git a/src/egs/manifest_item.rs b/src/egs/manifest_item.rs index 29dc4c4b..9f38f7ed 100644 --- a/src/egs/manifest_item.rs +++ b/src/egs/manifest_item.rs @@ -35,15 +35,14 @@ pub(crate) struct ManifestItem { fn exe_shortcut(manifest: ManifestItem) -> ShortcutOwned { let exe = manifest.exe(); - let mut start_dir = manifest.install_location.clone(); - if !manifest.install_location.starts_with('"') { - start_dir = format!("\"{}\"", manifest.install_location); - } + let start_dir = manifest.install_location.clone(); + let exe = exe.trim_matches('\"'); + let start_dir = start_dir.trim_matches('\"'); Shortcut::new( 0, manifest.display_name.as_str(), - exe.as_str(), - start_dir.as_str(), + exe, + start_dir, "", "", "",