mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Make platforms generic
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
use crate::platform::Platform;
|
||||
|
||||
use super::{
|
||||
get_egs_manifests, get_manifests::EpicGamesManifestsError, EpicGamesLauncherSettings,
|
||||
ManifestItem,
|
||||
};
|
||||
|
||||
pub struct EpicPlatform {
|
||||
settings: EpicGamesLauncherSettings,
|
||||
}
|
||||
|
||||
impl EpicPlatform {
|
||||
pub fn new(settings: EpicGamesLauncherSettings) -> Self {
|
||||
EpicPlatform { settings }
|
||||
}
|
||||
}
|
||||
|
||||
impl Platform<ManifestItem, EpicGamesManifestsError> for EpicPlatform {
|
||||
fn enabled(&self) -> bool {
|
||||
self.settings.enabled
|
||||
}
|
||||
|
||||
fn name(&self) -> &str {
|
||||
"EGS"
|
||||
}
|
||||
|
||||
fn get_shortcuts(&self) -> Result<Vec<ManifestItem>, EpicGamesManifestsError> {
|
||||
get_egs_manifests(&self.settings)
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,8 @@ pub struct ManifestItem {
|
||||
pub app_name: String,
|
||||
}
|
||||
|
||||
impl From<&ManifestItem> for ShortcutOwned {
|
||||
fn from(manifest: &ManifestItem) -> Self {
|
||||
impl From<ManifestItem> for ShortcutOwned {
|
||||
fn from(manifest: ManifestItem) -> Self {
|
||||
let exe = format!(
|
||||
"\"{}\\{}\"",
|
||||
manifest.install_location, manifest.launch_executable
|
||||
|
||||
+5
-2
@@ -1,6 +1,9 @@
|
||||
mod get_manifests;
|
||||
mod manifest_item;
|
||||
mod settings;
|
||||
mod epic_platform;
|
||||
|
||||
pub use manifest_item::*;
|
||||
pub use get_manifests::get_egs_manifests;
|
||||
pub use settings::EpicGamesLauncherSettings;
|
||||
use get_manifests::get_egs_manifests;
|
||||
pub use settings::EpicGamesLauncherSettings;
|
||||
pub use epic_platform::*;
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize,Clone)]
|
||||
pub struct EpicGamesLauncherSettings {
|
||||
pub enabled: bool,
|
||||
pub location: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user