From 0e8b9285c9dfede540e550e40d6e007582e9b519 Mon Sep 17 00:00:00 2001 From: mxve <68632137+mxve@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:44:34 +0100 Subject: [PATCH] fix steamlocate beta.2 --- src/main.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0c09778..1530128 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,17 +22,20 @@ use steamlocate::SteamDir; #[cfg(windows)] fn get_installed_games(games: &Vec) -> Vec<(u32, PathBuf)> { let mut installed_games = Vec::new(); - let mut steamdir = match SteamDir::locate() { - Some(steamdir) => steamdir, - None => { - println!("{}", "Steam not found!".yellow()); + let steamdir_result = SteamDir::locate(); + + let steamdir = match steamdir_result { + Ok(steamdir) => steamdir, + Err(error) => { + println!("Error locating Steam: {}", error); return installed_games; } }; for game in games { - if let Some(app) = steamdir.app(&game.app_id) { - installed_games.push((game.app_id, PathBuf::from(&app.path))); + if let Ok(Some((app, library))) = steamdir.find_app(game.app_id) { + let game_path = library.path().join("steamapps").join("common").join(&app.install_dir); + installed_games.push((game.app_id, game_path)); } }