From 39f5a23d1a8a666d16f830635c94ba52582bc4f9 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Fri, 25 Oct 2024 10:13:31 +0200 Subject: [PATCH] [#2108] do not download the same file again --- Admin/Update-Engines.ps1 | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/Admin/Update-Engines.ps1 b/Admin/Update-Engines.ps1 index c8e92c0dc1..2322ead62a 100644 --- a/Admin/Update-Engines.ps1 +++ b/Admin/Update-Engines.ps1 @@ -241,22 +241,27 @@ foreach ($p in $Platforms) { $fullPkgUrl = $engineUrl + $manifest.ManifestFile.Package.version + "/" + $manifest.ManifestFile.Package.FullPackage.name $fullPkgPath = ($fullPkgDir + $manifest.ManifestFile.Package.FullPackage.name) - $wc.DownloadFile($fullPkgUrl, $fullPkgPath) + if (((Test-Path $fullPkgPath) -ne $true) -or ((Get-Item $fullPkgPath).Length -ne $manifest.ManifestFile.Package.FullPackage.Size)) { + $wc.DownloadFile($fullPkgUrl, $fullPkgPath) - # Detect if there are any subdirectories - # needed for this engine - $subDirCount = $manifest.ManifestFile.Package.Files.Dir.Count + # Detect if there are any subdirectories + # needed for this engine + $subDirCount = $manifest.ManifestFile.Package.Files.Dir.Count - for ($i=0; $i -lt $subDirCount; $i++) { - CreatePath ($fullPkgDir + $manifest.ManifestFile.Package.Files.Dir[$i].name) - } + for ($i=0; $i -lt $subDirCount; $i++) { + CreatePath ($fullPkgDir + $manifest.ManifestFile.Package.Files.Dir[$i].name) + } - ExtractCab $fullPkgPath $fullPkgDir + ExtractCab $fullPkgPath $fullPkgDir - # Copy the downloaded manifest to the package directory - Copy-Item $manifestPath -Destination $fullPkgDir + # Copy the downloaded manifest to the package directory + Copy-Item $manifestPath -Destination $fullPkgDir - Write-Host "Download Complete: " $engine.Name + Write-Host "Download Complete: " $engine.Name + } + else { + Write-Host "Engine already up to date: " $engine.Name + } } } }