From 42e97e3b0d996c6a00c5d1758d3b5ccc3c12a650 Mon Sep 17 00:00:00 2001 From: mtkennerly Date: Tue, 15 Oct 2024 11:39:31 -0400 Subject: [PATCH] Check multiple capitalizations of SteamAppId just in case --- src/wrap.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/wrap.rs b/src/wrap.rs index 7672f3b..0a65f91 100644 --- a/src/wrap.rs +++ b/src/wrap.rs @@ -17,16 +17,21 @@ impl WrapGameInfo { } pub fn infer_game_from_steam() -> Option { - let app_id = std::env::var("SteamAppId").ok()?.parse::().ok()?; + for var in ["SteamAppId", "STEAMAPPID"] { + let Ok(raw) = std::env::var(var) else { continue }; + let Ok(app_id) = raw.parse::() 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 {