diff --git a/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Winget-AutoUpdate/Winget-Upgrade.ps1 index d5d9c44..50415f0 100644 --- a/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -92,7 +92,7 @@ if (Test-Network) { #Get External ModsPath if System if ($WAUConfig.WAU_ModsPath) { Write-Log "WAU uses External Mods from: $($WAUConfig.WAU_ModsPath)" - $NewMods = Test-ModsPath $WAUConfig.WAU_ModsPath $WAUConfig.InstallLocation + $NewMods, $DeletedMods = Test-ModsPath $WAUConfig.WAU_ModsPath $WAUConfig.InstallLocation if ($NewMods -gt 0) { Write-Log "Newer Mods downloaded/copied to local path: $($WAUConfig.InstallLocation)\mods" "Yellow" } @@ -104,6 +104,9 @@ if (Test-Network) { Write-Log "No Mods are implemented..." "Yellow" } } + if ($DeletedMods -gt 0) { + Write-Log "Deleted Local Mods (not externally managed): $DeletedMods" "Green" + } } } diff --git a/Winget-AutoUpdate/functions/Test-ModsPath.ps1 b/Winget-AutoUpdate/functions/Test-ModsPath.ps1 index d61b53a..40d4e88 100644 --- a/Winget-AutoUpdate/functions/Test-ModsPath.ps1 +++ b/Winget-AutoUpdate/functions/Test-ModsPath.ps1 @@ -30,6 +30,7 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) { try { If ($Mod -notin $ModLinks) { Remove-Item $LocalMods\$Mod -Force | Out-Null + $DeletedMods++ } } catch { @@ -65,7 +66,7 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) { } } } - return $ModsUpdated + return $ModsUpdated, $DeletedMods } # If path is UNC or local else { @@ -77,6 +78,7 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) { try { If($Mod -notin $ExternalModsNames ){ Remove-Item $LocalMods\$Mod -Force | Out-Null + $DeletedMods++ } } catch { @@ -104,7 +106,7 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) { catch { return $False } - return $ModsUpdated + return $ModsUpdated, $DeletedMods } } return $False