support alternative key

This commit is contained in:
nyyu 2018-06-10 12:42:02 +02:00
parent f3503df2ec
commit 71038e9a44

View file

@ -76,6 +76,7 @@ fn main() {
Ok(x) => x, Ok(x) => x,
Err(_e) => PathBuf::from(LOL_CHAMPS_DIR), Err(_e) => PathBuf::from(LOL_CHAMPS_DIR),
}; };
info!("LoL Champs Folder: {}", lol_champs_dir.to_str().unwrap());
let mut headers = Headers::new(); let mut headers = Headers::new();
headers.set(UserAgent::new(USER_AGENT)); headers.set(UserAgent::new(USER_AGENT));
@ -276,11 +277,15 @@ fn write_item_set(
fn lol_champ_dir() -> Result<PathBuf, io::Error> { fn lol_champ_dir() -> Result<PathBuf, io::Error> {
let hklm = RegKey::predef(winreg::enums::HKEY_LOCAL_MACHINE); let hklm = RegKey::predef(winreg::enums::HKEY_LOCAL_MACHINE);
let node = hklm.open_subkey(r"SOFTWARE\WOW6432Node\Riot Games\RADS")?; let node = hklm.open_subkey(r"SOFTWARE\WOW6432Node\Riot Games\RADS");
let dir: String = node.get_value("LocalRootFolder")?; let path: PathBuf;
Ok(PathBuf::from(&dir) if node.is_ok() {
.parent() let val: String = node?.get_value("LocalRootFolder")?;
.unwrap() path = PathBuf::from(val).parent().unwrap().to_path_buf();
.join("Config") } else {
.join("Champions")) let node = hklm.open_subkey(r"SOFTWARE\WOW6432Node\Riot Games, Inc\League of Legends");
let val: String = node?.get_value("Location")?;
path = PathBuf::from(val);
}
Ok(path.join("Config").join("Champions"))
} }