Skip to content

Commit f8aa644

Browse files
andyclaude
andcommitted
MSI: explicit GUIDs for the empty-directory components
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PFPK14wBcLD1s4dYUowpP4
1 parent 117512d commit f8aa644

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎packaging/windows/make-msi.ps1‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@ $msiVer = "$($Matches[1]).$($Matches[2]).$($Matches[3]).$n"
1818
$ids = @{}; $nid = 0
1919
$sb = New-Object System.Text.StringBuilder
2020
function Esc($s) { [Security.SecurityElement]::Escape($s) }
21+
# Stable per path, so upgrades see the same component.
22+
function DirGuid($d) {
23+
$rel = $d.Substring($Tree.Length).ToLowerInvariant()
24+
$h = [Security.Cryptography.MD5]::Create().ComputeHash([Text.Encoding]::UTF8.GetBytes("ecce-dir:$rel"))
25+
(New-Object Guid (,$h)).ToString().ToUpper()
26+
}
2127
function Emit($dir, $indent) {
2228
# Empty directories (the shell's tmp) are not installed unless something creates them.
2329
if (-not (Get-ChildItem -LiteralPath $dir -Force)) {
2430
$script:nid++
25-
[void]$sb.AppendLine("$indent<Component Id=`"c$nid`"><CreateFolder /></Component>")
31+
[void]$sb.AppendLine("$indent<Component Id=`"c$nid`" Guid=`"$(DirGuid $dir)`"><CreateFolder /></Component>")
2632
}
2733
foreach ($f in Get-ChildItem -LiteralPath $dir -File) {
2834
$script:nid++

0 commit comments

Comments
 (0)