From 04dd756217210ba02fafc5084ef10732152968b5 Mon Sep 17 00:00:00 2001 From: KnifMelti Date: Fri, 4 Nov 2022 22:40:03 +0100 Subject: [PATCH] Cleaned --- Winget-AutoUpdate/functions/Test-ModsPath.ps1 | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/Winget-AutoUpdate/functions/Test-ModsPath.ps1 b/Winget-AutoUpdate/functions/Test-ModsPath.ps1 index 83fd286..d61b53a 100644 --- a/Winget-AutoUpdate/functions/Test-ModsPath.ps1 +++ b/Winget-AutoUpdate/functions/Test-ModsPath.ps1 @@ -23,20 +23,18 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) { return $False } + # Get the list of links, skip the first one ("../") if listing is allowed + $ModLinks = $WebResponse.Links | Select-Object -ExpandProperty href -Skip 1 #Delete Local Mods that doesn't exist Externally - if ($WebResponse) { - # Get the list of links, skip the first one ("../") if listing is allowed - $ModLinks = $WebResponse.Links | Select-Object -ExpandProperty href -Skip 1 - foreach ($Mod in $InternalModsNames) { - try { - If ($Mod -notin $ModLinks) { - Remove-Item $LocalMods\$Mod -Force | Out-Null - } - } - catch { - #Do nothing + foreach ($Mod in $InternalModsNames) { + try { + If ($Mod -notin $ModLinks) { + Remove-Item $LocalMods\$Mod -Force | Out-Null } } + catch { + #Do nothing + } } #Loop through all links