From ffc5d6610d5a2fea1f865b34aaaca85c655873b1 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Thu, 25 Apr 2024 05:19:18 +0200 Subject: [PATCH] Fix for [Bug]: -WAUWhitelist doesn't work if included_apps.txt does not already exist #605 --- Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 b/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 index e764292..f0278fa 100644 --- a/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 @@ -258,6 +258,10 @@ function Uninstall-App ($AppID, $AppArgs) { function Add-WAUWhiteList ($AppID) { #Check if WAU default intall path exists $WhiteList = "$WAUInstallLocation\included_apps.txt" + #Create included_apps.txt if it doesn't exist + if ((Test-Path $WAUInstallLocation) -and !(Test-Path $WhiteList)) { + New-Item -ItemType File -Path $WhiteList -Force -ErrorAction SilentlyContinue + } if (Test-Path $WhiteList) { Write-ToLog "-> Add $AppID to WAU included_apps.txt" #Add App to "included_apps.txt"