From edd97b1a3d76ba7bc0eb18e6057ab272112fd80c Mon Sep 17 00:00:00 2001 From: BlankenshipG Date: Sun, 4 Oct 2026 16:50:01 -0400 Subject: [PATCH] fix(installer): trim Inno's padded ProductVersion before comparing Co-authored-by: Cursor --- installer/Build-Installer.ps1 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/installer/Build-Installer.ps1 b/installer/Build-Installer.ps1 index 3f5dd74..6550f63 100644 --- a/installer/Build-Installer.ps1 +++ b/installer/Build-Installer.ps1 @@ -432,6 +432,9 @@ Write-Host "Staging complete: $StagingRoot" -ForegroundColor Green # ── Archive the previous installer when -Version bumps ───────────────────── # installer\previous-release\last-built-version.txt records the last version built; when a new # -Version is built, that version's installer is copied to previous-release\ first. +# Inno stamps AppVersion as the setup exe's ProductVersion, padded with spaces/NULs. +function Get-InstallerVersion([string]$Exe) { "$((Get-Item $Exe).VersionInfo.ProductVersion)".Trim([char[]]" `0") } + $previousReleaseDir = Join-Path $ScriptDir "previous-release" $lastVersionFile = Join-Path $previousReleaseDir "last-built-version.txt" if ($Version) { @@ -444,8 +447,8 @@ if ($Version) { # another checkout); only archive it when its stamped ProductVersion really is $lastVer. $canonical = Join-Path $ScriptDir "Output\RynthCore-Setup.exe" $prevExe = $null - if ((Test-Path $canonical) -and ((Get-Item $canonical).VersionInfo.ProductVersion -eq $lastVer)) { $prevExe = $canonical } - elseif (Test-Path $canonical) { Write-Warning "Previous installer $lastVer not found in Output\ (RynthCore-Setup.exe is $((Get-Item $canonical).VersionInfo.ProductVersion)); nothing archived." } + if ((Test-Path $canonical) -and ((Get-InstallerVersion $canonical) -eq $lastVer)) { $prevExe = $canonical } + elseif (Test-Path $canonical) { Write-Warning "Previous installer $lastVer not found in Output\ (RynthCore-Setup.exe is $(Get-InstallerVersion $canonical)); nothing archived." } } if ($prevExe -and (Test-Path $prevExe)) { $archive = Join-Path $previousReleaseDir "RynthCore-Setup-$lastVer.exe" @@ -547,7 +550,7 @@ if ($Version -and -not $NoPackage) { Write-Host "Assembling deployment package..." -ForegroundColor Cyan # The installer must carry this release's version (Inno stamps AppVersion as ProductVersion). - $stamped = (Get-Item $builtInstaller).VersionInfo.ProductVersion + $stamped = Get-InstallerVersion $builtInstaller if ($stamped -ne $Version) { throw "Installer ProductVersion is '$stamped', expected '$Version'." } $pkgName = "Release-$Version" @@ -574,7 +577,7 @@ if ($Version -and -not $NoPackage) { $components = foreach ($kv in $componentFiles.GetEnumerator()) { $vi = (Get-Item $kv.Value).VersionInfo $ver = if ($vi.ProductVersion) { $vi.ProductVersion } else { $vi.FileVersion } - [ordered]@{ name = $kv.Key; file = $kv.Value.Substring($StagingRoot.Length + 1); version = "$ver" } + [ordered]@{ name = $kv.Key; file = $kv.Value.Substring($StagingRoot.Length + 1); version = "$ver".Trim([char[]]" `0") } } # Changelog entries since the previous release (its manifest's commits, else its build date).