+function Test-AndroidStudioCurrent {
+ # Installed at all counts as current, because Android Studio keeps itself
+ # current: it updates in the app (Help > Check for Updates), and the winget
+ # package is published with UpgradeBehavior: deny and RequireExplicitUpgrade,
+ # so winget would not upgrade it anyway. The check matters for an install
+ # that did not come from winget - measured on the x64 laptop, where winget
+ # lists Studio only as "ARP\Machine\X64\Android Studio", unmatched to
+ # Google.AndroidStudio - since `winget install` would then run the installer
+ # over it. Looked for both ways: the Add/Remove Programs entry its installer
+ # writes, and studio64.exe where that installer puts it.
+ $arp = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*',
+ 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*',
+ 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' -ErrorAction SilentlyContinue |
+ Where-Object { $_.DisplayName -eq 'Android Studio' }
+ $exe = @((Join-Path $env:ProgramFiles 'Android\Android Studio\bin\studio64.exe'),
+ (Join-Path $env:LOCALAPPDATA 'Programs\Android Studio\bin\studio64.exe')) | Where-Object { Test-Path $_ }
+ if (-not $arp -and -not $exe) { Say 'AndroidStudio: not installed yet.'; return $false }
+ $ver = @($arp)[0].DisplayVersion
+ Say "AndroidStudio: $(if ($ver) { $ver } else { 'an existing install' }) is already here, and it updates itself (Help > Check for Updates); not reinstalling."
+ $true
+}
+