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) { if ($WAUConfig.WAU_ModsPath) {
Write-Log "WAU uses External Mods from: $($WAUConfig.WAU_ModsPath)" Write-Log "WAU uses External Mods from: $($WAUConfig.WAU_ModsPath)"
$NewMods = Test-ModsPath $WAUConfig.WAU_ModsPath $WAUConfig.InstallLocation $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" Write-Log "Newer Mods downloaded/copied to local path: $($WAUConfig.InstallLocation)\mods" "Yellow"
} }
else { else {

View File

@ -32,9 +32,9 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) {
} }
# If path is UNC or local # If path is UNC or local
else { else {
if (Test-Path -Path $ExternalMods"\*.ps1") {
#Get File Names Externally #Get File Names Externally
$ExternalModsNames = Get-ChildItem -Path $ExternalMods -Name -Recurse -Include *.ps1 $ExternalModsNames = Get-ChildItem -Path $ExternalMods -Name -Recurse -Include *.ps1
if (Test-Path -Path $ExternalMods"\*.ps1") {
#Delete Local Mods that doesn't exist Externally #Delete Local Mods that doesn't exist Externally
foreach ($Mod in $InternalModsNames){ foreach ($Mod in $InternalModsNames){
try { try {
@ -55,17 +55,19 @@ function Test-ModsPath ($ModsPath, $WingetUpdatePath) {
if ($dateExternalMod -gt $dateLocalMod) { if ($dateExternalMod -gt $dateLocalMod) {
try { try {
Copy-Item $ExternalMods\$Mod -Destination $LocalMods\$Mod -Force Copy-Item $ExternalMods\$Mod -Destination $LocalMods\$Mod -Force
return $True $ModsUpdated++
} }
catch { catch {
return $False return $False
} }
} }
} }
} }
catch { catch {
return $False return $False
} }
return $ModsUpdated
} }
} }
return $False return $False