From 78ed7c070ac918fdfc2fd99b90607ecf5ab611da Mon Sep 17 00:00:00 2001 From: romanitho <96626929+Romanitho@users.noreply.github.com> Date: Mon, 30 Oct 2023 23:50:51 +0100 Subject: [PATCH] Adjustments --- Winget-AutoUpdate-Install.ps1 | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Winget-AutoUpdate-Install.ps1 b/Winget-AutoUpdate-Install.ps1 index baefcdd..0228cdb 100644 --- a/Winget-AutoUpdate-Install.ps1 +++ b/Winget-AutoUpdate-Install.ps1 @@ -230,7 +230,6 @@ function Install-WinGet { #Install/Update Winget Update-WinGet $WinGetAvailableVersion - Write-ToLog "-> WinGet v$WinGetInstalledVersion installed!`n" "Green" } else { Write-ToLog "-> WinGet is up to date: v$WinGetInstalledVersion`n" "Green" @@ -246,15 +245,14 @@ function Install-WingetAutoUpdate { if (!(Test-Path $WAUinstallPath)) { New-Item -ItemType Directory -Force -Path $WAUinstallPath | Out-Null } - else { - if (!$NoClean) { - Remove-Item -Path "$WAUinstallPath\*" -Exclude *.log -Recurse -Force - } - else { - #Keep critical files - Get-ChildItem -Path $WAUinstallPath -Exclude *.txt, mods, logs | Remove-Item -Recurse -Force - } + elseif (!$NoClean) { + Remove-Item -Path "$WAUinstallPath\*" -Exclude *.log -Recurse -Force } + else { + #Keep critical files + Get-ChildItem -Path $WAUinstallPath -Exclude *.txt, mods, logs | Remove-Item -Recurse -Force + } + Copy-Item -Path "$PSScriptRoot\Winget-AutoUpdate\*" -Destination $WAUinstallPath -Recurse -Force -ErrorAction SilentlyContinue #White List or Black List apps