Skip to content

Commit

Permalink
Check multiple capitalizations of SteamAppId just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Oct 15, 2024
1 parent 6679665 commit 42e97e3
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,21 @@ impl WrapGameInfo {
}

pub fn infer_game_from_steam() -> Option<WrapGameInfo> {
let app_id = std::env::var("SteamAppId").ok()?.parse::<u32>().ok()?;
for var in ["SteamAppId", "STEAMAPPID"] {
let Ok(raw) = std::env::var(var) else { continue };
let Ok(app_id) = raw.parse::<u32>() else { continue };

log::debug!("Found Steam environment variable: SteamAppId={}", app_id);
log::debug!("Found Steam environment variable: {}={}", var, app_id);

let result = WrapGameInfo {
steam_id: Some(app_id),
..Default::default()
};
let result = WrapGameInfo {
steam_id: Some(app_id),
..Default::default()
};

return Some(result);
}

(!result.is_empty()).then_some(result)
None
}

pub mod lutris {
Expand Down

0 comments on commit 42e97e3

Please sign in to comment.