Files
msime-windows/scripts/ci/install-inno-language.ps1
Evan Hu 7c6dc8b6a0 fix(release): install the Inno Setup language file where ISCC looks
Every release build since the packaging pipeline landed has failed at "Compile the installer", which is why the last eight versions are still unpublished drafts:

    Error on line 63 in msime_setup.iss: Couldn't open include file
    "c:\program files (x86)\inno setup 6\Languages\ChineseSimplified.isl"

install-inno-language.ps1 derived the destination from `Get-Command ISCC.exe`. On the windows-2025 image Inno Setup comes from Chocolatey, so that resolves to the shim at C:\ProgramData\Chocolatey\bin\ISCC.exe and the file was written to C:\ProgramData\Chocolatey\bin\Languages\. ISPP resolves compiler: against the real installation. The step printed "Installed ... (21516 bytes)" and exited 0, and the build failed two steps later pointing at a path nothing had written to, which is why this survived eight releases.

The installation is now located by a file only it has -- ISPPBuiltins.iss or Default.isl, neither of which sits beside a shim -- checking the uninstall registry key, the two Program Files locations and any ISCC.exe on PATH, and failing with the list it tried rather than falling back to a guess.

ci.yml now compiles a throwaway script whose only content is a [Languages] entry pointing at compiler:Languages\ChineseSimplified.isl. Asserting the file exists at a path this script computed would only restate the script's own belief; compiling is what proves ISCC agrees. The URL and digest pin moved into the script so that check does not need a second copy of them.
2026-09-06 01:37:13 +09:00

69 lines
3.4 KiB
PowerShell

# Put the Chinese language file where the Inno Setup compiler will actually look for it.
#
# msime_setup.iss declares a chinesesimplified language pointing at
# compiler:Languages\ChineseSimplified.isl, and the Inno Setup on the runner does not ship that
# file, so ISCC aborts on the [Languages] section. Pinned by commit and checksum rather than
# tracking a branch, so the installer's Chinese text cannot change under a rebuild.
#
# "Where ISCC.exe is" is not the answer. On the windows-2025 image Inno Setup comes from Chocolatey
# and `Get-Command ISCC.exe` resolves to the shim at C:\ProgramData\Chocolatey\bin\ISCC.exe, so
# deriving the directory from it installed the file to C:\ProgramData\Chocolatey\bin\Languages\.
# ISPP resolves compiler: against the real installation, which is why every release build reported
# "Installed ... ChineseSimplified.isl" and then failed two steps later with "Couldn't open include
# file c:\program files (x86)\inno setup 6\Languages\ChineseSimplified.isl".
#
# So find the installation by a file only it has, and refuse to guess. Getting this wrong silently
# is what made it cost a whole release cycle to notice.
$ErrorActionPreference = 'Stop'
# The pin lives here rather than in the workflow so that ci.yml can run this script as a regression
# check without keeping a second copy of the URL and digest in step with this one.
$url = 'https://raw.githubusercontent.com/jrsoftware/issrc/1ae7bf81dc0d2013235dfe4bb0b6f4e4a0b6b25c/Files/Languages/ChineseSimplified.isl'
$expected = 'e0b0b350e2245f3c5e65586dfe43d574f6e7f06f2261149aba284954b3fc9a8d'
# Present in the installation directory and absent from a shim directory.
$markers = @('ISPPBuiltins.iss', 'Default.isl')
$candidates = [System.Collections.Generic.List[string]]::new()
foreach ($key in @(
'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1',
'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 6_is1')) {
$location = (Get-ItemProperty -Path $key -Name 'InstallLocation' -ErrorAction SilentlyContinue).InstallLocation
if ($location) { $candidates.Add($location.TrimEnd('\')) }
}
foreach ($base in @(${env:ProgramFiles(x86)}, $env:ProgramFiles)) {
if ($base) { $candidates.Add((Join-Path $base 'Inno Setup 6')) }
}
foreach ($command in @(Get-Command 'ISCC.exe' -CommandType Application -ErrorAction SilentlyContinue)) {
$candidates.Add((Split-Path $command.Source -Parent))
}
$root = $candidates |
Where-Object { $_ -and (Test-Path $_) } |
Where-Object { $directory = $_; $markers | Where-Object { Test-Path (Join-Path $directory $_) } } |
Select-Object -First 1
if (-not $root) {
throw "Could not find the Inno Setup installation. Looked in: $($candidates -join '; ')"
}
Write-Host "Inno Setup installation: $root"
$languages = Join-Path $root 'Languages'
$target = Join-Path $languages 'ChineseSimplified.isl'
if (Test-Path $target) {
Write-Host "Already present: $target"
exit 0
}
New-Item -ItemType Directory -Path $languages -Force | Out-Null
Invoke-WebRequest -Uri $url -OutFile $target -MaximumRetryCount 3 -RetryIntervalSec 5
$actual = (Get-FileHash $target -Algorithm SHA256).Hash.ToLower()
if ($actual -ne $expected) {
Remove-Item $target -Force
throw "ChineseSimplified.isl checksum mismatch: expected $expected, got $actual"
}
Write-Host "Installed $target ($((Get-Item $target).Length) bytes)"