This commit is contained in:
parent
b08dd9c6c0
commit
d02a3c6a1d
1 changed files with 7 additions and 10 deletions
17
src/main.rs
17
src/main.rs
|
@ -158,28 +158,26 @@ fn lol_champ_dir() -> Result<PathBuf, Error> {
|
|||
let node = hklm.open_subkey(r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
|
||||
let mut sub_node: io::Result<RegKey> = Err(Error::from(ErrorKind::NotFound));
|
||||
|
||||
if node.is_ok() {
|
||||
let n = node.unwrap();
|
||||
if let Ok(n) = node {
|
||||
let key = n
|
||||
.enum_keys()
|
||||
.map(|x| x.unwrap())
|
||||
.find(|x| x.starts_with("League of Legends"));
|
||||
if key.is_some() {
|
||||
sub_node = n.open_subkey(key.unwrap());
|
||||
if let Some(k) = key {
|
||||
sub_node = n.open_subkey(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if sub_node.is_err() {
|
||||
let hkcu = RegKey::predef(winreg::enums::HKEY_CURRENT_USER);
|
||||
let node = hkcu.open_subkey(r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\");
|
||||
if node.is_ok() {
|
||||
let n = node.unwrap();
|
||||
if let Ok(n) = node {
|
||||
let key = n
|
||||
.enum_keys()
|
||||
.map(|x| x.unwrap())
|
||||
.find(|x| x == "Riot Game league_of_legends.live");
|
||||
if key.is_some() {
|
||||
sub_node = n.open_subkey(key.unwrap());
|
||||
if let Some(k) = key {
|
||||
sub_node = n.open_subkey(k);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +187,6 @@ fn lol_champ_dir() -> Result<PathBuf, Error> {
|
|||
return Ok(PathBuf::from(val).join("Config").join("Champions"));
|
||||
}
|
||||
|
||||
|
||||
Err(Error::from(ErrorKind::NotFound))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue