Small fixes

pull/232/head
KnifMelti 2022-11-03 01:19:04 +01:00
parent 0c1cf4aed0
commit 231e6fa2f2
2 changed files with 6 additions and 4 deletions

View File

@ -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 {

View File

@ -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