mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Epic safe launch (#85)
This feature lets users force some Epic Games to be launched through the Epic Launcher
This commit is contained in:
@@ -10,8 +10,8 @@ pub struct EpicPlatform {
|
||||
}
|
||||
|
||||
impl EpicPlatform {
|
||||
pub fn new(settings: EpicGamesLauncherSettings) -> Self {
|
||||
EpicPlatform { settings }
|
||||
pub fn new(settings: &EpicGamesLauncherSettings) -> Self {
|
||||
EpicPlatform { settings: settings.clone() }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,11 @@ pub(crate) fn get_egs_manifests(
|
||||
let mut manifests : Vec<ManifestItem> = 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));
|
||||
for mut manifest in &mut manifests{
|
||||
if settings.safe_launch.contains(&manifest.display_name) || settings.safe_launch.contains(&manifest.get_key()){
|
||||
manifest.safe_launch = true;
|
||||
}
|
||||
}
|
||||
Ok(manifests)
|
||||
}
|
||||
Err(err) => Err(ReadDirError {
|
||||
|
||||
@@ -31,6 +31,9 @@ pub(crate) struct ManifestItem {
|
||||
|
||||
#[serde(alias = "ExpectingDLCInstalled")]
|
||||
pub expected_dlc: Option<HashMap<String, bool>>,
|
||||
|
||||
#[serde(default)]
|
||||
pub safe_launch: bool,
|
||||
}
|
||||
|
||||
fn exe_shortcut(manifest: ManifestItem) -> ShortcutOwned {
|
||||
@@ -96,7 +99,18 @@ impl ManifestItem {
|
||||
self.catalog_namespace, self.catalog_item_id, self.app_name
|
||||
)
|
||||
}
|
||||
|
||||
pub fn get_key(&self) -> String{
|
||||
format!(
|
||||
"{}-{}-{}",
|
||||
self.catalog_namespace, self.catalog_item_id, self.app_name
|
||||
)
|
||||
}
|
||||
|
||||
fn needs_launcher(&self) -> bool {
|
||||
if self.safe_launch{
|
||||
return true;
|
||||
}
|
||||
match (&self.is_managed, &self.expected_dlc) {
|
||||
(true, _) => true,
|
||||
(false, Some(map)) => !map.is_empty(),
|
||||
|
||||
@@ -7,4 +7,6 @@ pub struct EpicGamesLauncherSettings {
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
pub create_symlinks: bool,
|
||||
|
||||
pub safe_launch : Vec<String>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user