Packaging: the Windows installer offers a desktop shortcut, on by default (#343)
The MSI only installed a Start Menu shortcut. The wizard's folder page now has a "Create a desktop shortcut" box (DESKTOPSHORTCUT, 1 by default; DESKTOPSHORTCUT=0 for silent installs) that adds an EffectCraft shortcut to the Public desktop. The choice is recorded under HKLM\Software\EffectCraft so an upgrade keeps it, and an upgrade from a release before this option adds none. test-msi.ps1 checks the shortcut is created by default, kept by upgrades, removed on uninstall and absent with DESKTOPSHORTCUT=0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QiAJeFttZp83Fh7YuzAR5f
This commit is contained in:
@@ -10,8 +10,10 @@
|
||||
installed effectcraft.exe, as there is no Path value yet),
|
||||
3. upgrades to 0.0.3 the same way (found from the Path value 0.0.2 wrote),
|
||||
4. repairs a damaged (unversioned) CLI there with the wizard's Repair mode,
|
||||
5. uninstalls: files and the App Paths registration go,
|
||||
6. installs 0.0.3 with no folder: it must land in Program Files, then uninstalls.
|
||||
5. uninstalls: files, the App Paths registration and the desktop shortcut go,
|
||||
6. installs 0.0.3 with no folder and DESKTOPSHORTCUT=0: it must land in Program Files with no
|
||||
desktop shortcut, then uninstalls.
|
||||
The installs before step 6 take the default desktop shortcut, which upgrades keep.
|
||||
The wizard itself needs a person (or the snapshot steps in the PR); this covers what msiexec /qn
|
||||
and upgrades do with the folder. Needs an elevated shell and WiX v5 (`wix`) on PATH.
|
||||
Run by .github/workflows/packaging-lint.yml.
|
||||
@@ -24,6 +26,8 @@ $ErrorActionPreference = 'Stop'
|
||||
trap { Write-Output "FAILED: $_"; exit 1 }
|
||||
$Root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
|
||||
$AppPaths = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\effectcraft.exe'
|
||||
# A per-machine install's desktop is the Public one.
|
||||
$DesktopLink = Join-Path ([Environment]::GetFolderPath('CommonDesktopDirectory')) 'EffectCraft.lnk'
|
||||
|
||||
function Invoke-Native([string] $What, [scriptblock] $Block) {
|
||||
Write-Output "==> $What"
|
||||
@@ -50,6 +54,10 @@ function Assert-InstalledIn([string] $Dir, [switch] $NoPathValue) {
|
||||
}
|
||||
Write-Output "ok installed in $Dir"
|
||||
}
|
||||
function Assert-DesktopShortcut([bool] $Present) {
|
||||
if ((Test-Path -LiteralPath $DesktopLink) -ne $Present) { throw "desktop shortcut present: $(-not $Present), expected $Present" }
|
||||
Write-Output "ok desktop shortcut present: $Present"
|
||||
}
|
||||
|
||||
Remove-Item -Recurse -Force $Work -ErrorAction SilentlyContinue
|
||||
$Bin = Join-Path $Work 'bin'
|
||||
@@ -87,6 +95,7 @@ if (Test-Path -LiteralPath $AppPaths) { throw 'EffectCraft is already installed
|
||||
|
||||
Invoke-Msiexec 'install the legacy package to a custom folder' @('/i', "`"$($Msi['0.0.1'])`"", "INSTALLFOLDER=`"$Custom`"")
|
||||
Assert-InstalledIn $Custom -NoPathValue
|
||||
Assert-DesktopShortcut $true
|
||||
if (Test-Path -LiteralPath $Default) { throw "a custom install also wrote $Default" }
|
||||
|
||||
Invoke-Msiexec 'upgrade the legacy install without a folder' @('/i', "`"$($Msi['0.0.2'])`"")
|
||||
@@ -95,6 +104,7 @@ if (Test-Path -LiteralPath $Default) { throw "the upgrade moved the install to $
|
||||
|
||||
Invoke-Msiexec 'upgrade again without a folder' @('/i', "`"$($Msi['0.0.3'])`"")
|
||||
Assert-InstalledIn $Custom
|
||||
Assert-DesktopShortcut $true
|
||||
# Read single values: Get-ItemProperty throws on some machines' malformed Uninstall entries.
|
||||
$arp = @(Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' |
|
||||
ForEach-Object { if ($_.GetValue('DisplayName') -eq 'EffectCraft') { $_.GetValue('DisplayVersion') } })
|
||||
@@ -117,9 +127,11 @@ Write-Output "ok repair ($mode) restored effectcraft-cli.exe"
|
||||
Invoke-Msiexec 'uninstall the custom install' @('/x', "`"$($Msi['0.0.3'])`"")
|
||||
if (Test-Path -LiteralPath (Join-Path $Custom 'effectcraft.exe')) { throw 'uninstall left effectcraft.exe behind' }
|
||||
if (Test-Path -LiteralPath $AppPaths) { throw 'uninstall left the App Paths registration behind' }
|
||||
Assert-DesktopShortcut $false
|
||||
|
||||
Invoke-Msiexec 'install to the default folder' @('/i', "`"$($Msi['0.0.3'])`"")
|
||||
Invoke-Msiexec 'install to the default folder without a desktop shortcut' @('/i', "`"$($Msi['0.0.3'])`"", 'DESKTOPSHORTCUT=0')
|
||||
Assert-InstalledIn $Default
|
||||
Assert-DesktopShortcut $false
|
||||
Invoke-Msiexec 'uninstall the default install' @('/x', "`"$($Msi['0.0.3'])`"")
|
||||
if (Test-Path -LiteralPath (Join-Path $Default 'effectcraft.exe')) { throw 'uninstall left effectcraft.exe behind' }
|
||||
Write-Output 'MSI folder handling ok'
|
||||
|
||||
Reference in New Issue
Block a user