Skip to content

Commit

Permalink
VSCode Format
Browse files Browse the repository at this point in the history
  • Loading branch information
Romanitho committed Jun 10, 2022
1 parent 929e106 commit 624f419
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 77 deletions.
12 changes: 6 additions & 6 deletions winget-detect.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ Function Get-WingetCmd {

#Get WinGet Path (if admin context)
$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe"
if ($ResolveWingetPath){
if ($ResolveWingetPath) {
#If multiple version, pick last one
$WingetPath = $ResolveWingetPath[-1].Path
}

#Get Winget Location in User context
$WingetCmd = Get-Command winget.exe -ErrorAction SilentlyContinue
if ($WingetCmd){
if ($WingetCmd) {
$Script:Winget = $WingetCmd.Source
}
#Get Winget Location in System context (WinGet < 1.17)
elseif (Test-Path "$WingetPath\AppInstallerCLI.exe"){
elseif (Test-Path "$WingetPath\AppInstallerCLI.exe") {
$Script:Winget = "$WingetPath\AppInstallerCLI.exe"
}
#Get Winget Location in System context (WinGet > 1.17)
elseif (Test-Path "$WingetPath\winget.exe"){
elseif (Test-Path "$WingetPath\winget.exe") {
$Script:Winget = "$WingetPath\winget.exe"
}
else{
else {
break
}
}
Expand All @@ -40,6 +40,6 @@ Get-WingetCmd
$InstalledApp = & $winget list --Id $AppToDetect --accept-source-agreements | Out-String

#Return if AppID existe in the list
if ($InstalledApp -match [regex]::Escape($AppToDetect)){
if ($InstalledApp -match [regex]::Escape($AppToDetect)) {
return "Installed!"
}
Loading

0 comments on commit 624f419

Please sign in to comment.