Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 5 additions & 13 deletions src/linux/launchers/bottles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,9 @@ impl Bottles {
let mut parsed_games_data: Vec<ParsableBottleYmlData> = Vec::new();
let mut file_content_str: &str = &file_content;

loop {
let Ok((new_file_content, parsed_data)) = parse_game_from_bottle_yml(file_content_str)
else {
break;
};
while let Ok((new_file_content, parsed_data)) = parse_game_from_bottle_yml(file_content_str)
{
file_content_str = new_file_content;

parsed_games_data.push(parsed_data)
}

Expand Down Expand Up @@ -263,13 +259,9 @@ impl Bottles {
let mut parsed_data: Vec<ParsableLibraryData> = Vec::new();
let mut library_file_content_str: &str = &library_file_content;

loop {
let Ok((new_library_file_content, parsed_library_data)) =
parse_game_from_library(library_file_content_str)
else {
break;
};

while let Ok((new_library_file_content, parsed_library_data)) =
parse_game_from_library(library_file_content_str)
{
library_file_content_str = new_library_file_content;
parsed_data.push(parsed_library_data);
}
Expand Down
17 changes: 15 additions & 2 deletions src/linux/launchers/lutris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,21 @@ use crate::{
};

// DB DATA --------------------------------------------------------------------------------
const PGA_DB_QUERY: &str =
"SELECT id, name, slug, installer_slug, parent_slug, directory, playtime FROM games;";
const PGA_DB_QUERY: &str = "\
SELECT id, name, slug, installer_slug, parent_slug, directory, playtime, installed, runner \
FROM games;\
";

/// Data returned directly by the query to the pga.db
#[derive(Debug, Clone)]
struct DbRow {
run_id: String,
runner: Option<String>,
title: String,
slug: String,
installer_slug: Option<String>,
game_dir: Option<String>,
installed: bool,
_parent_slug: Option<String>,
_playtime: Option<f64>,
}
Expand All @@ -40,12 +44,14 @@ impl<'stmt> TryFrom<&rusqlite::Row<'stmt>> for DbRow {
fn try_from(row: &rusqlite::Row) -> std::result::Result<Self, Self::Error> {
Ok(Self {
run_id: row.get::<&str, i32>("id")?.to_string(),
runner: row.get("runner")?,
title: row.get("name")?,
slug: row.get("slug")?,
installer_slug: row.get("installer_slug")?,
_parent_slug: row.get("parent_slug")?,
game_dir: row.get("directory")?,
_playtime: row.get("playtime")?,
installed: row.get("installed")?,
})
}
}
Expand Down Expand Up @@ -125,6 +131,13 @@ impl Lutris {
stmt.query(params![])
.inspect_err(|e| error!("{LAUNCHER} - failed to execute DB query: {e}"))?
.map(|r| DbRow::try_from(r))
.filter(|r| Ok(r.installed))
// WARN: Ignore Steam entries entirely.
// This is more of an opinion, as these lead to duplicate entries,
// and do not inherently belong to Lutris anyway (will still just
// launch through Steam). Feel free to start a discussion if you disagree.
// See: https://github.com/Rolv-Apneseth/lib_game_detector/issues/53
.filter(|r| Ok(r.runner.as_ref().is_none_or(|s| s != "steam")))
.collect::<Vec<DbRow>>()
.inspect(|rows| {
if rows.is_empty() {
Expand Down
Binary file modified tests/file_system_mocks/linux/.local/share/lutris/pga.db
Binary file not shown.
Loading