mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Revert Lutris change when "installed" is true
This commit is contained in:
@@ -62,6 +62,6 @@ mod tests {
|
|||||||
|
|
||||||
let games = parse_lutris_games(content);
|
let games = parse_lutris_games(content);
|
||||||
|
|
||||||
assert_eq!(games[1].service, "steam");
|
assert_eq!(games[1].service.clone().unwrap_or_default(), "steam");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ pub struct LutrisGame {
|
|||||||
pub id: i64,
|
pub id: i64,
|
||||||
pub slug: String,
|
pub slug: String,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub service: String,
|
pub service: Option<String>,
|
||||||
|
pub runner:Option<String>,
|
||||||
pub installed: bool,
|
pub installed: bool,
|
||||||
pub details: String,
|
pub details: String,
|
||||||
pub settings: Option<LutrisSettings>,
|
pub settings: Option<LutrisSettings>,
|
||||||
@@ -39,17 +40,25 @@ impl LutrisGame {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|s| s.flatpak)
|
.map(|s| s.flatpak)
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
let run_game = self
|
||||||
|
.settings
|
||||||
|
.as_ref()
|
||||||
|
.map(|s| s.installed)
|
||||||
|
.map(|i| if i { ":rungame/" } else { ":" })
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
if is_flatpak {
|
if is_flatpak {
|
||||||
format!(
|
format!(
|
||||||
"run {} lutris:{}",
|
"run {} lutris{}{}",
|
||||||
self.settings
|
self.settings
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|s| s.flatpak_image.clone())
|
.map(|s| s.flatpak_image.clone())
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
|
run_game,
|
||||||
self.slug
|
self.slug
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
format!("lutris:{}", self.slug)
|
format!("lutris{}{}", run_game, self.slug)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,11 @@ impl LutrisPlatform {
|
|||||||
fn get_shortcuts(&self) -> eyre::Result<Vec<LutrisGame>> {
|
fn get_shortcuts(&self) -> eyre::Result<Vec<LutrisGame>> {
|
||||||
let output = get_lutris_command_output(&self.settings)?;
|
let output = get_lutris_command_output(&self.settings)?;
|
||||||
let games = parse_lutris_games(output.as_str());
|
let games = parse_lutris_games(output.as_str());
|
||||||
|
let installed = self.settings.installed;
|
||||||
let mut res = vec![];
|
let mut res = vec![];
|
||||||
for mut game in games {
|
for mut game in games {
|
||||||
if game.service != "steam" {
|
let service = if installed { game.runner.clone().unwrap_or_default() } else { game.service.clone().unwrap_or_default() };
|
||||||
|
if service != "steam" {
|
||||||
game.settings = Some(self.settings.clone());
|
game.settings = Some(self.settings.clone());
|
||||||
res.push(game);
|
res.push(game);
|
||||||
}
|
}
|
||||||
@@ -32,16 +34,12 @@ fn get_lutris_command_output(settings: &LutrisSettings) -> eyre::Result<String>
|
|||||||
#[cfg(not(feature = "flatpak"))]
|
#[cfg(not(feature = "flatpak"))]
|
||||||
{
|
{
|
||||||
let mut command = Command::new("flatpak");
|
let mut command = Command::new("flatpak");
|
||||||
command
|
command.arg("run").arg(flatpak_image).arg("--json");
|
||||||
.arg("run")
|
if settings.installed {
|
||||||
.arg(flatpak_image)
|
command.arg("-lo").output()?
|
||||||
.arg("-a")
|
} else {
|
||||||
.arg("--json");
|
command.arg("-a").output()?
|
||||||
if settings.installed {
|
}
|
||||||
command.arg("-o").output()?
|
|
||||||
} else {
|
|
||||||
command.output()?
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#[cfg(feature = "flatpak")]
|
#[cfg(feature = "flatpak")]
|
||||||
{
|
{
|
||||||
@@ -50,22 +48,21 @@ fn get_lutris_command_output(settings: &LutrisSettings) -> eyre::Result<String>
|
|||||||
.arg("--host")
|
.arg("--host")
|
||||||
.arg("flatpak")
|
.arg("flatpak")
|
||||||
.arg("run")
|
.arg("run")
|
||||||
.arg(flatpak_image)
|
.arg(flatpak_image);
|
||||||
.arg("-a")
|
command.arg("run").arg(flatpak_image).arg("--json");
|
||||||
.arg("--json");
|
if settings.installed {
|
||||||
if settings.installed {
|
command.arg("-lo").output()?
|
||||||
command.arg("-o").output()?
|
} else {
|
||||||
} else {
|
command.arg("-a").output()?
|
||||||
command.output()?
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let mut command = Command::new(&settings.executable);
|
let mut command = Command::new(&settings.executable);
|
||||||
command.arg("-a").arg("--json");
|
command.arg("--json");
|
||||||
if settings.installed {
|
if settings.installed {
|
||||||
command.arg("-o").output()?
|
command.arg("-lo").output()?
|
||||||
} else {
|
} else {
|
||||||
command.output()?
|
command.arg("-a").output()?
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user