From c2366be79969c3129cfc78ed16eac0754ccfacd8 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Wed, 10 Aug 2022 17:22:39 +0200 Subject: [PATCH] Fixing -NoClean a little --- Winget-AutoUpdate-Install.ps1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Winget-AutoUpdate-Install.ps1 b/Winget-AutoUpdate-Install.ps1 index 89d94da..d71ffef 100644 --- a/Winget-AutoUpdate-Install.ps1 +++ b/Winget-AutoUpdate-Install.ps1 @@ -204,13 +204,21 @@ function Install-WingetAutoUpdate { } } elseif (!(Test-Path "$WingetUpdatePath\included_apps.txt")) { - New-Item -Path $WingetUpdatePath -Name "included_apps.txt" -ItemType "file" -ErrorAction SilentlyContinue | Out-Null + if ((Test-Path "$PSScriptRoot\included_apps.txt")) { + Copy-Item -Path "$PSScriptRoot\included_apps.txt" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue + } + else { + New-Item -Path $WingetUpdatePath -Name "included_apps.txt" -ItemType "file" -ErrorAction SilentlyContinue | Out-Null + } } } else { if (!$NoClean) { Copy-Item -Path "$PSScriptRoot\excluded_apps.txt" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue } + elseif (!(Test-Path "$WingetUpdatePath\excluded_apps.txt")) { + Copy-Item -Path "$PSScriptRoot\excluded_apps.txt" -Destination $WingetUpdatePath -Recurse -Force -ErrorAction SilentlyContinue + } } # Set dummy regkeys for notification name and icon