Made build script not delete logs and zips

This commit is contained in:
MaddoScientisto 2026-02-07 22:44:06 +01:00
commit c2cc5db381

View file

@ -125,16 +125,20 @@ function Initialize-BuildDirectories {
Write-Host "Initializing build directories..." -ForegroundColor Cyan
if (Test-Path $BuildDir) {
Remove-Item "$BuildDir\*" -Recurse -Force -ErrorAction SilentlyContinue
} else {
# Ensure the root build directory exists but DO NOT delete its contents (preserve logs and zips)
if (-not (Test-Path $BuildDir)) {
New-Item -ItemType Directory -Path $BuildDir | Out-Null
}
foreach ($platform in $PlatformsToBuild) {
$platformDir = Join-Path $BuildDir $script:platforms[$platform].OutputSubDir
if (Test-Path $platformDir) {
# Clear only the platform directory contents
Remove-Item "$platformDir\*" -Recurse -Force -ErrorAction SilentlyContinue
} else {
New-Item -ItemType Directory -Path $platformDir -Force | Out-Null
Write-Host " Created: $platformDir" -ForegroundColor Gray
}
Write-Host " Prepared: $platformDir" -ForegroundColor Gray
}
}
@ -254,7 +258,7 @@ function Create-PlatformZip {
# Create zip
Write-Host " Creating zip archive: $zipFileName" -ForegroundColor Cyan
try {
if (Test-Path $zipFilePath) { Remove-Item $zipFilePath -Force }
# Do not explicitly delete existing zip to avoid losing historical artifacts; Compress-Archive -Force will overwrite
Compress-Archive -Path "$platformDir\*" -DestinationPath $zipFilePath -Force
Write-Host " Zip created: $zipFilePath" -ForegroundColor Green
return $zipFilePath