mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Add support for lutris flatpak version (#114)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::lutris::settings::LutrisSettings;
|
||||
use steam_shortcuts_util::{shortcut::ShortcutOwned, Shortcut};
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -6,15 +7,17 @@ pub struct LutrisGame {
|
||||
pub name: String,
|
||||
pub id: String,
|
||||
pub platform: String,
|
||||
pub settings: Option<LutrisSettings>,
|
||||
}
|
||||
|
||||
impl From<LutrisGame> for ShortcutOwned {
|
||||
fn from(game: LutrisGame) -> Self {
|
||||
let options = format!("lutris:rungame/{}", game.id);
|
||||
let options = game.get_options();
|
||||
let exectuable = game.get_executable();
|
||||
Shortcut::new(
|
||||
"0",
|
||||
game.name.as_str(),
|
||||
"lutris",
|
||||
exectuable.as_str(),
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
@@ -23,3 +26,41 @@ impl From<LutrisGame> for ShortcutOwned {
|
||||
.to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
impl LutrisGame {
|
||||
pub fn get_options(&self) -> String {
|
||||
let is_flatpak = self
|
||||
.settings
|
||||
.as_ref()
|
||||
.map(|s| s.flatpak)
|
||||
.unwrap_or_default();
|
||||
if is_flatpak {
|
||||
format!(
|
||||
"run {} lutris:rungame/{}",
|
||||
self.settings
|
||||
.as_ref()
|
||||
.map(|s| s.flatpak_image.clone())
|
||||
.unwrap_or_default(),
|
||||
self.id
|
||||
)
|
||||
} else {
|
||||
format!("lutris:rungame/{}", self.id)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_executable(&self) -> String {
|
||||
let is_flatpak = self
|
||||
.settings
|
||||
.as_ref()
|
||||
.map(|s| s.flatpak)
|
||||
.unwrap_or_default();
|
||||
if is_flatpak {
|
||||
"flatpak".to_string()
|
||||
} else {
|
||||
self.settings
|
||||
.as_ref()
|
||||
.map(|s| s.executable.clone())
|
||||
.unwrap_or_default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user