mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-14 19:27:05 -04:00
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 <[email protected]> Claude-Session: https://claude.ai/code/session_01QiAJeFttZp83Fh7YuzAR5f
This commit is contained in:
3 files changed
+39
-5
No files matched your search
@@ -4,7 +4,8 @@
|
||||
|
||||
wix build effectcraft.wxs installer-ui.wxs -arch x64 -d Version=1.2.3 -d BinDir=... -d IconPath=... -o out.msi
|
||||
|
||||
Per-machine install into Program Files (or a folder the user picks) and a Start Menu shortcut.
|
||||
Per-machine install into Program Files (or a folder the user picks), a Start Menu shortcut and,
|
||||
unless DESKTOPSHORTCUT=0 (the wizard's "Create a desktop shortcut" box), a desktop shortcut.
|
||||
-->
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Package
|
||||
@@ -49,10 +50,21 @@
|
||||
<SetProperty Id="INSTALLFOLDER" Action="SetINSTALLFOLDERFromExe" Value="[PREVIOUSEXEFOLDER]"
|
||||
After="SetINSTALLFOLDER" Sequence="both" Condition="PREVIOUSEXEFOLDER AND NOT INSTALLFOLDER" />
|
||||
|
||||
<!-- The desktop shortcut: on by default for a fresh install (a box in the wizard, or
|
||||
DESKTOPSHORTCUT=0 silently); an upgrade keeps what the installed copy chose, and adds none
|
||||
to an install from before this option. -->
|
||||
<Property Id="DESKTOPSHORTCUT" Value="1" Secure="yes" />
|
||||
<Property Id="PREVIOUSDESKTOPSHORTCUT" Secure="yes">
|
||||
<RegistrySearch Id="PreviousDesktopShortcut" Root="HKLM" Type="raw" Key="Software\EffectCraft" Name="DesktopShortcut" />
|
||||
</Property>
|
||||
<SetProperty Id="DESKTOPSHORTCUT" Value="[PREVIOUSDESKTOPSHORTCUT]" After="SetINSTALLFOLDERFromExe" Sequence="both"
|
||||
Condition="WIX_UPGRADE_DETECTED" />
|
||||
|
||||
<StandardDirectory Id="ProgramFiles6432Folder">
|
||||
<Directory Id="INSTALLFOLDER" Name="EffectCraft" />
|
||||
</StandardDirectory>
|
||||
<StandardDirectory Id="ProgramMenuFolder" />
|
||||
<StandardDirectory Id="DesktopFolder" />
|
||||
|
||||
<Feature Id="Main" Title="EffectCraft" Level="1">
|
||||
<ComponentGroupRef Id="EffectcraftFiles" />
|
||||
@@ -70,11 +82,20 @@
|
||||
|
||||
<RegistryValue Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\effectcraft.exe" Value="[#EffectcraftExe]" Type="string" />
|
||||
<RegistryValue Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\effectcraft.exe" Name="Path" Value="[INSTALLFOLDER]" Type="string" />
|
||||
<!-- The desktop shortcut choice, for the next upgrade (empty: none). -->
|
||||
<RegistryValue Root="HKLM" Key="Software\EffectCraft" Name="DesktopShortcut" Value="[DESKTOPSHORTCUT]" Type="string" />
|
||||
</Component>
|
||||
|
||||
<Component Id="EffectcraftCli">
|
||||
<File Id="EffectcraftCliExe" Source="$(var.BinDir)\effectcraft-cli.exe" KeyPath="yes" />
|
||||
</Component>
|
||||
|
||||
<!-- A component under the user's profile folders needs an HKCU key path (ICE38, ICE43). -->
|
||||
<Component Id="DesktopShortcut" Directory="DesktopFolder" Condition="DESKTOPSHORTCUT = "1"">
|
||||
<Shortcut Id="DesktopShortcut" Name="EffectCraft" Description="EffectCraft motion graphics and visual effects"
|
||||
Target="[#EffectcraftExe]" WorkingDirectory="INSTALLFOLDER" Icon="EffectcraftIcon.ico" IconIndex="0" />
|
||||
<RegistryValue Root="HKCU" Key="Software\EffectCraft" Name="DesktopShortcut" Value="1" Type="string" KeyPath="yes" />
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
@@ -3,7 +3,7 @@
|
||||
EffectCraft installer wizard: original dialogs built from Windows Installer's own controls and
|
||||
events (no WixUI library), included by effectcraft.wxs with <UIRef Id="EffectcraftUI" />.
|
||||
|
||||
fresh install: DestDlg (folder, Change... opens BrowseDlg) -> ReadyDlg -> ProgressDlg -> ExitDlg
|
||||
fresh install: DestDlg (folder, Change... opens BrowseDlg, desktop shortcut) -> ReadyDlg -> ProgressDlg -> ExitDlg
|
||||
upgrade: ReadyDlg (the installed copy's folder, not editable) -> ProgressDlg -> ExitDlg
|
||||
already there: MaintDlg (Repair or Remove) -> ProgressDlg -> ExitDlg
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<Control Id="ChangeFolder" Type="PushButton" X="290" Y="99" Width="60" Height="20" Text="&Change...">
|
||||
<Publish Event="SpawnDialog" Value="BrowseDlg" />
|
||||
</Control>
|
||||
<Control Id="DesktopShortcut" Type="CheckBox" X="20" Y="132" Width="330" Height="17" Property="DESKTOPSHORTCUT" CheckBoxValue="1" Text="Create a &desktop shortcut" />
|
||||
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
|
||||
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&Back" Disabled="yes" />
|
||||
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&Next">
|
||||
|
||||
@@ -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