@@ -212,6 +212,29 @@ fn get_version(command: &str, args: &[&str]) -> crate::Result<Option<String>> {
212212 Ok ( version)
213213}
214214
215+ #[ cfg( windows) ]
216+ fn webview2_version ( ) -> crate :: Result < Option < String > > {
217+ let output = Command :: new ( "powershell" )
218+ . args ( & [ "-NoProfile" , "-Command" ] )
219+ . arg ( "Get-ItemProperty -Path 'HKLM:\\ SOFTWARE\\ WOW6432Node\\ Microsoft\\ EdgeUpdate\\ Clients\\ {F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' | ForEach-Object {$_.pv}" )
220+ . output ( ) ?;
221+ let version = if output. status . success ( ) {
222+ Some ( String :: from_utf8_lossy ( & output. stdout ) . replace ( "\n " , "" ) )
223+ } else {
224+ // check 32bit installation
225+ let output = Command :: new ( "powershell" )
226+ . args ( & [ "-NoProfile" , "-Command" ] )
227+ . arg ( "Get-ItemProperty -Path 'HKLM:\\ SOFTWARE\\ Microsoft\\ EdgeUpdate\\ Clients\\ {F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' | ForEach-Object {$_.pv}" )
228+ . output ( ) ?;
229+ if output. status . success ( ) {
230+ Some ( String :: from_utf8_lossy ( & output. stdout ) . replace ( "\n " , "" ) )
231+ } else {
232+ None
233+ }
234+ } ;
235+ Ok ( version)
236+ }
237+
215238struct InfoBlock {
216239 section : bool ,
217240 key : & ' static str ,
@@ -289,7 +312,7 @@ impl VersionBlock {
289312 if let Some ( version) = & self . version {
290313 print ! ( " - {}" , version) ;
291314 } else {
292- print ! ( " Not installed" ) ;
315+ print ! ( " - Not installed" ) ;
293316 }
294317 if let ( Some ( version) , Some ( target_version) ) = ( & self . version , & self . target_version ) {
295318 let version = semver:: Version :: parse ( version) . unwrap ( ) ;
@@ -322,6 +345,9 @@ impl Info {
322345 }
323346 . display ( ) ;
324347
348+ #[ cfg( windows) ]
349+ VersionBlock :: new ( "Webview2" , webview2_version ( ) . unwrap_or_default ( ) ) . display ( ) ;
350+
325351 let hook = panic:: take_hook ( ) ;
326352 panic:: set_hook ( Box :: new ( |_info| {
327353 // do nothing
0 commit comments