diff --git a/src/main.rs b/src/main.rs index 1539fc9..1320710 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,7 @@ use indexmap::IndexMap; -use log::{debug, error, info, LevelFilter}; +#[cfg(target_os = "windows")] +use log::debug; +use log::{error, info, LevelFilter}; use serde_derive::Deserialize; use simple_logger::SimpleLogger; use std::env; @@ -45,10 +47,14 @@ const USER_AGENT_KEY: &str = "User-Agent"; const USER_AGENT_VALUE: &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0"; const DEFAULT_LOL_CHAMPS_DIR: &str = ".\\champs"; +#[cfg(target_os = "windows")] const REG_KEY_LOL_RADS: &str = r"SOFTWARE\WOW6432Node\Riot Games\RADS"; +#[cfg(target_os = "windows")] const REG_KEY_LOL_INC: &str = r"SOFTWARE\WOW6432Node\Riot Games, Inc\League of Legends"; +#[cfg(target_os = "windows")] const REG_KEY_WIN_64_UNINSTALL: &str = r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall"; +#[cfg(target_os = "windows")] const REG_KEY_WIN_UNINSTALL: &str = r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"; fn main() -> Result<(), Box> { @@ -196,6 +202,7 @@ fn lol_champ_dir() -> Result { Ok(PathBuf::from(DEFAULT_LOL_CHAMPS_DIR)) } +#[cfg(target_os = "windows")] fn find_subnode_from_path(reg: RegKey, path: &str, key: &str) -> io::Result { if let Ok(node) = reg.open_subkey(path) { if let Some(k) = node