Files
figcraft/packaging/windows/check-icons.ps1
Brandon ThomasandClaude Opus 5.5 b36fd771ab M0.9: MCP server + figcraft-cli, PDF export, web app, release/CI packaging, vector edit mode, workspace lint cleanup
- crates/mcp: JSON-RPC MCP server (18 tools, resources, prompts), headless and attached backends, end-to-end agent tests
- apps/figcraft-cli: info/export/convert/render/run/commands/mcp/perf
- crates/pdf: vector PDF export via krilla with embedded text; file.exportFramesPdf
- apps/figcraft-web + packaging/{macos,windows,linux,freebsd,web} + release/ci workflows
- engine vectoredit: edit points/handles/bend/add/delete-heal; canvas overlay and edit strip

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 13:31:53 -04:00

47 lines
2.0 KiB
PowerShell

<#
.SYNOPSIS
Check MSI icon references without building or installing FigCraft.
.DESCRIPTION
ICE50 requires advertised shortcut icon identifiers to have the target file's extension.
Windows Installer uses those identifiers as cached filenames; extensionless identifiers
can display a generic document icon even when the ICO data and application are valid.
#>
param(
[string] $WxsPath = (Join-Path $PSScriptRoot 'figcraft.wxs')
)
$ErrorActionPreference = 'Stop'
[xml] $Wxs = Get-Content -LiteralPath $WxsPath -Raw
$Ns = [Xml.XmlNamespaceManager]::new($Wxs.NameTable)
$Ns.AddNamespace('w', 'http://wixtoolset.org/schemas/v4/wxs')
$Icons = @{}
foreach ($icon in $Wxs.SelectNodes('//w:Icon', $Ns)) {
$Icons[$icon.GetAttribute('Id')] = $icon
}
foreach ($shortcut in $Wxs.SelectNodes('//w:File/w:Shortcut[@Advertise="yes"]', $Ns)) {
$id = $shortcut.GetAttribute('Id')
$iconId = $shortcut.GetAttribute('Icon')
if (-not $Icons.ContainsKey($iconId)) {
throw "Advertised shortcut '$id' references missing icon '$iconId'."
}
$iconExtension = [IO.Path]::GetExtension($iconId)
if ($iconExtension -notin '.exe', '.ico') {
throw "Advertised shortcut '$id' icon '$iconId' must have an .exe or .ico extension (ICE50)."
}
$file = $shortcut.ParentNode
$fileName = if ($file.HasAttribute('Name')) { $file.GetAttribute('Name') } else { $file.GetAttribute('Source') }
# Source paths use Windows separators even when this check runs on Linux in packaging-lint.
$fileName = ($fileName -split '[\\/]')[-1]
$targetExtension = [IO.Path]::GetExtension($fileName)
if ($iconExtension -ne $targetExtension) {
throw "Advertised shortcut '$id' icon '$iconId' must match target '$fileName' extension '$targetExtension' (ICE50)."
}
}
$arpIcon = $Wxs.SelectSingleNode('//w:Property[@Id="ARPPRODUCTICON"]', $Ns)
if ($arpIcon -and -not $Icons.ContainsKey($arpIcon.GetAttribute('Value'))) {
throw "ARPPRODUCTICON references missing icon '$($arpIcon.GetAttribute('Value'))'."
}
Write-Output 'Windows shortcut icon references ok'