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 node = hklm.open_subkey(r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall");
|
||||||
let mut sub_node: io::Result<RegKey> = Err(Error::from(ErrorKind::NotFound));
|
let mut sub_node: io::Result<RegKey> = Err(Error::from(ErrorKind::NotFound));
|
||||||
|
|
||||||
if node.is_ok() {
|
if let Ok(n) = node {
|
||||||
let n = node.unwrap();
|
|
||||||
let key = n
|
let key = n
|
||||||
.enum_keys()
|
.enum_keys()
|
||||||
.map(|x| x.unwrap())
|
.map(|x| x.unwrap())
|
||||||
.find(|x| x.starts_with("League of Legends"));
|
.find(|x| x.starts_with("League of Legends"));
|
||||||
if key.is_some() {
|
if let Some(k) = key {
|
||||||
sub_node = n.open_subkey(key.unwrap());
|
sub_node = n.open_subkey(k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if sub_node.is_err() {
|
if sub_node.is_err() {
|
||||||
let hkcu = RegKey::predef(winreg::enums::HKEY_CURRENT_USER);
|
let hkcu = RegKey::predef(winreg::enums::HKEY_CURRENT_USER);
|
||||||
let node = hkcu.open_subkey(r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\");
|
let node = hkcu.open_subkey(r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\");
|
||||||
if node.is_ok() {
|
if let Ok(n) = node {
|
||||||
let n = node.unwrap();
|
|
||||||
let key = n
|
let key = n
|
||||||
.enum_keys()
|
.enum_keys()
|
||||||
.map(|x| x.unwrap())
|
.map(|x| x.unwrap())
|
||||||
.find(|x| x == "Riot Game league_of_legends.live");
|
.find(|x| x == "Riot Game league_of_legends.live");
|
||||||
if key.is_some() {
|
if let Some(k) = key {
|
||||||
sub_node = n.open_subkey(key.unwrap());
|
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"));
|
return Ok(PathBuf::from(val).join("Config").join("Champions"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Err(Error::from(ErrorKind::NotFound))
|
Err(Error::from(ErrorKind::NotFound))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue