diff --git a/Winget-AutoUpdate/Winget-Upgrade.ps1 b/Winget-AutoUpdate/Winget-Upgrade.ps1 index e3d5222..d5d9c44 100644 --- a/Winget-AutoUpdate/Winget-Upgrade.ps1 +++ b/Winget-AutoUpdate/Winget-Upgrade.ps1 @@ -93,7 +93,7 @@ if (Test-Network) { if ($WAUConfig.WAU_ModsPath) { Write-Log "WAU uses External Mods from: $($WAUConfig.WAU_ModsPath)" $NewMods = Test-ModsPath $WAUConfig.WAU_ModsPath $WAUConfig.InstallLocation - if ($NewMods) { + if ($NewMods -gt 0) { Write-Log "Newer Mods downloaded/copied to local path: $($WAUConfig.InstallLocation)\mods" "Yellow" } else { diff --git a/Winget-AutoUpdate/functions/Test-ModsPath.ps1 b/Winget-AutoUpdate/functions/Test-ModsPath.ps1 index ca5899e..6d1d811 100644 --- a/Winget-AutoUpdate/functions/Test-ModsPath.ps1 +++ b/Winget-AutoUpdate/functions/Test-ModsPath.ps1 @@ -32,9 +32,9 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) { } # If path is UNC or local else { - #Get File Names Externally - $ExternalModsNames = Get-ChildItem -Path $ExternalMods -Name -Recurse -Include *.ps1 if (Test-Path -Path $ExternalMods"\*.ps1") { + #Get File Names Externally + $ExternalModsNames = Get-ChildItem -Path $ExternalMods -Name -Recurse -Include *.ps1 #Delete Local Mods that doesn't exist Externally foreach ($Mod in $InternalModsNames){ try { @@ -55,17 +55,19 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) { if ($dateExternalMod -gt $dateLocalMod) { try { Copy-Item $ExternalMods\$Mod -Destination $LocalMods\$Mod -Force - return $True + $ModsUpdated++ } catch { return $False } } } + } catch { return $False } + return $ModsUpdated } } return $False