diff --git a/tooling/bundler/src/bundle/windows/templates/main.wxs b/tooling/bundler/src/bundle/windows/templates/main.wxs index 132f5150b..22a048953 100644 --- a/tooling/bundler/src/bundle/windows/templates/main.wxs +++ b/tooling/bundler/src/bundle/windows/templates/main.wxs @@ -219,7 +219,8 @@ {{#if install_webview}} - + + diff --git a/tooling/cli.rs/src/info.rs b/tooling/cli.rs/src/info.rs index 907359b21..9a0014bc7 100644 --- a/tooling/cli.rs/src/info.rs +++ b/tooling/cli.rs/src/info.rs @@ -271,25 +271,38 @@ fn get_version(command: &str, args: &[&str]) -> crate::Result> { #[cfg(windows)] fn webview2_version() -> crate::Result> { + // check 64bit machine-wide installation let output = Command::new("powershell") .args(&["-NoProfile", "-Command"]) .arg("Get-ItemProperty -Path 'HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\EdgeUpdate\\Clients\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' | ForEach-Object {$_.pv}") .output()?; - let version = if output.status.success() { - Some(String::from_utf8_lossy(&output.stdout).replace('\n', "")) - } else { - // check 32bit installation - let output = Command::new("powershell") + if output.status.success() { + return Ok(Some( + String::from_utf8_lossy(&output.stdout).replace('\n', ""), + )); + } + // check 32bit machine-wide installation + let output = Command::new("powershell") .args(&["-NoProfile", "-Command"]) .arg("Get-ItemProperty -Path 'HKLM:\\SOFTWARE\\Microsoft\\EdgeUpdate\\Clients\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' | ForEach-Object {$_.pv}") .output()?; - if output.status.success() { - Some(String::from_utf8_lossy(&output.stdout).replace('\n', "")) - } else { - None - } - }; - Ok(version) + if output.status.success() { + return Ok(Some( + String::from_utf8_lossy(&output.stdout).replace('\n', ""), + )); + } + // check user-wide installation + let output = Command::new("powershell") + .args(&["-NoProfile", "-Command"]) + .arg("Get-ItemProperty -Path 'HKCU:\\SOFTWARE\\Microsoft\\EdgeUpdate\\Clients\\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' | ForEach-Object {$_.pv}") + .output()?; + if output.status.success() { + return Ok(Some( + String::from_utf8_lossy(&output.stdout).replace('\n', ""), + )); + } + + Ok(None) } #[cfg(windows)]