fix steamlocate beta.2

This commit is contained in:
mxve 2024-01-02 11:44:34 +01:00
parent 725ec09e5e
commit 0e8b9285c9

View File

@ -22,17 +22,20 @@ use steamlocate::SteamDir;
#[cfg(windows)] #[cfg(windows)]
fn get_installed_games(games: &Vec<Game>) -> Vec<(u32, PathBuf)> { fn get_installed_games(games: &Vec<Game>) -> Vec<(u32, PathBuf)> {
let mut installed_games = Vec::new(); let mut installed_games = Vec::new();
let mut steamdir = match SteamDir::locate() { let steamdir_result = SteamDir::locate();
Some(steamdir) => steamdir,
None => { let steamdir = match steamdir_result {
println!("{}", "Steam not found!".yellow()); Ok(steamdir) => steamdir,
Err(error) => {
println!("Error locating Steam: {}", error);
return installed_games; return installed_games;
} }
}; };
for game in games { for game in games {
if let Some(app) = steamdir.app(&game.app_id) { if let Ok(Some((app, library))) = steamdir.find_app(game.app_id) {
installed_games.push((game.app_id, PathBuf::from(&app.path))); let game_path = library.path().join("steamapps").join("common").join(&app.install_dir);
installed_games.push((game.app_id, game_path));
} }
} }