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:
Claude
2026-10-10 22:30:58 +00:00
parent d024a16cf0
commit 1c7fcccef2
3 changed files with 39 additions and 5 deletions
+22 -1
View File
@@ -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 = &quot;1&quot;">
<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>