From 4563b7b5f605666e09b7e2ab6e7656ee3003642e Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Fri, 26 Apr 2024 03:56:21 +0200 Subject: [PATCH] Better fix --- Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 b/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 index f0278fa..73f4395 100644 --- a/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 +++ b/Sources/WAU/Winget-AutoUpdate/Winget-Install.ps1 @@ -256,13 +256,13 @@ function Uninstall-App ($AppID, $AppArgs) { #Function to Add app to WAU white list 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) { + #Check if WAU default intall path is defined + if ($WAUInstallLocation) { + $WhiteList = "$WAUInstallLocation\included_apps.txt" + #Create included_apps.txt if it doesn't exist + if (!(Test-Path $WhiteList)) { + New-Item -ItemType File -Path $WhiteList -Force -ErrorAction SilentlyContinue + } Write-ToLog "-> Add $AppID to WAU included_apps.txt" #Add App to "included_apps.txt" Add-Content -path $WhiteList -Value "`n$AppID" -Force