Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Issue #399: Windows MSI: choose the install folder; upgrades keep it

hxw485046bf3504
diff --git a/.github/workflows/packaging-lint.yml b/.github/workflows/packaging-lint.yml
index 0e2388a62..ed2d8f00a 100644
--- a/.github/workflows/packaging-lint.yml
+++ b/.github/workflows/packaging-lint.yml
@@ -51,6 +51,11 @@ jobs:
if grep -oE '<Icon Id="[^"]*"' packaging/windows/lightcraft.wxs | grep -vE '\.(ico|exe)"$'; then
echo "::error::Icon Id must end in .ico or .exe"; exit 1
fi
+ # The interactive installer asks where to install and ends on a completion page (issues #18, #399).
+ for want in '<UIRef Id="LightcraftUI" />' 'Value="InstallDirDlg"' '<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />' \
+ 'Key="Software\LightCraft" Name="InstallFolder"' 'Value="LaunchLightcraft"'; do
+ grep -qF "$want" packaging/windows/lightcraft.wxs || { echo "::error::lightcraft.wxs lost: $want"; exit 1; }
+ done
desktop-file-validate packaging/linux/ai.storyteller.lightcraft.desktop
sed -e 's/@VERSION@/0.0.0/' -e 's/@DATE@/2026-01-01/' packaging/linux/ai.storyteller.lightcraft.metainfo.xml.in >"$RUNNER_TEMP/ai.storyteller.lightcraft.metainfo.xml"
appstreamcli validate --no-net --explain "$RUNNER_TEMP/ai.storyteller.lightcraft.metainfo.xml"
diff --git a/README.md b/README.md
index e93683c63..ba7c960f9 100644
--- a/README.md
+++ b/README.md
@@ -444,7 +444,9 @@ Questions, ideas or a bug you'd like to talk through first? Bring them to [Disco
| arm64 (Snapdragon and other ARM PCs) | `lightcraft-<ver>-windows-arm64.msi` | `lightcraft-<ver>-windows-arm64-portable.zip` |
| x86 (32-bit) | `lightcraft-<ver>-windows-x86.msi` | `lightcraft-<ver>-windows-x86-portable.zip` |
-Installers and executables are code-signed.
+Installers and executables are code-signed. The installer asks where to install (`C:\Program Files\LightCraft` by
+default; upgrades stay in the folder you chose) and ends on a page confirming LightCraft was installed, with an
+option to start it. For unattended installs: `msiexec /i lightcraft-<ver>-windows-x64.msi /qn INSTALLFOLDER="D:\Apps\LightCraft\"`.
### macOS
diff --git a/docs/whats-new.md b/docs/whats-new.md
index 96b10a974..afcc1328e 100644
--- a/docs/whats-new.md
+++ b/docs/whats-new.md
@@ -129,6 +129,10 @@
)
### Reliability
+- The Windows installer asks where to install LightCraft (Program Files by default; upgrades keep the folder you
+ chose) and ends on a page saying it was installed, with a "Launch LightCraft" box. It used to finish without a word,
+ so a successful install looked like nothing had happened (issues #18, #399). Silent installs (`/qn`, `/passive`)
+ show no dialogs and take `INSTALLFOLDER=...`.
- If the desktop app can't open its window (for example when no graphics device can be used), it now says so in a
message box that names the log file, instead of quitting without a trace (issue #260).
- On macOS, single-key shortcuts that appear in the menu bar now work: E, C, H, M, ⇧P, I, K, D, ratings 0–5,
diff --git a/packaging/windows/lightcraft.wxs b/packaging/windows/lightcraft.wxs
index b6de42cfe..ce98a7143 100644
--- a/packaging/windows/lightcraft.wxs
+++ b/packaging/windows/lightcraft.wxs
@@ -6,7 +6,8 @@
wix build lightcraft.wxs -arch x64 -ext WixToolset.UI.wixext/5.0.2 -ext WixToolset.Util.wixext/5.0.2
-d Version=1.2.3 -d BinDir=... -d IconPath=... -d UiDialogBmp=... -d UiBannerBmp=... -o out.msi
- Per-machine install into Program Files, a Start Menu shortcut, `.pcraft` owned by LightCraft,
+ Per-machine install into Program Files (or the folder chosen in the installer, or
+ `INSTALLFOLDER=...` on the msiexec command line; upgrades keep it), a Start Menu shortcut, `.pcraft` owned by LightCraft,
and LightCraft offered under "Open with" for PSD/PSB and the image formats it reads (without
taking over the user's default app for them).
-->
@@ -35,6 +36,14 @@
<StandardDirectory Id="ProgramFiles6432Folder">
<Directory Id="INSTALLFOLDER" Name="LightCraft" />
</StandardDirectory>
+ <!-- The folder of the installed version (written by LightcraftApp), so an upgrade installs
+ where the user chose instead of moving back to Program Files (issue #399). Searched into
+ its own property: AppSearch would otherwise overwrite INSTALLFOLDER=... given to msiexec. -->
+ <Property Id="PREVIOUSINSTALLFOLDER">
+ <RegistrySearch Id="PreviousInstallFolder" Root="HKLM" Key="Software\LightCraft" Name="InstallFolder" Type="raw" />
+ </Property>
+ <SetProperty Id="INSTALLFOLDER" Value="[PREVIOUSINSTALLFOLDER]" After="AppSearch" Sequence="both"
+ Condition="PREVIOUSINSTALLFOLDER AND NOT INSTALLFOLDER" />
<StandardDirectory Id="ProgramMenuFolder" />
<Feature Id="Main" Title="LightCraft" Level="1">
@@ -45,12 +54,15 @@
</Package>
<!--
- Interactive install UI: Welcome -> Ready to install -> progress -> "Completed" (Finish), with a
- "Launch LightCraft" checkbox (checked by default). Failure and cancellation end on WiX's standard
- FatalError / UserExit dialogs instead of the completion page. Maintenance (running the MSI again,
- Repair/Remove from Apps) uses the standard maintenance dialogs.
-
- This is WixUI_Minimal without its licence-acceptance page: LightCraft is MIT OR Apache-2.0,
+ Interactive install UI: Welcome -> Destination Folder -> Ready to install -> progress ->
+ "Completed" (Finish), with a "Launch LightCraft" checkbox (checked by default). Destination
+ Folder (issue #399) shows Program Files\LightCraft, or the installed version's folder on an
+ upgrade; Change... browses, and a folder that can't be used (InvalidDirDlg) is refused before
+ anything is installed. Failure and cancellation end on WiX's standard FatalError / UserExit
+ dialogs instead of the completion page. Maintenance (running the MSI again, Repair/Remove from
+ Apps) uses the standard maintenance dialogs.
+
+ This is WixUI_InstallDir without its licence-acceptance page: LightCraft is MIT OR Apache-2.0,
which ask nothing of people who just install and run it, so a click-through EULA would only
add a step. Silent (/qn) and basic-UI (/passive, /qb) installs never show these dialogs, so
they are unaffected, and nothing is launched.
@@ -92,14 +104,44 @@
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<DialogRef Id="WelcomeDlg" />
+ <DialogRef Id="InstallDirDlg" />
+ <DialogRef Id="BrowseDlg" />
+ <DialogRef Id="InvalidDirDlg" />
+ <DialogRef Id="DiskCostDlg" />
<DialogRef Id="VerifyReadyDlg" />
<DialogRef Id="MaintenanceWelcomeDlg" />
<DialogRef Id="MaintenanceTypeDlg" />
- <!-- First install / upgrade (and patches): Welcome -> Ready to install. -->
- <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" />
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="1"
- Condition="NOT Installed OR PATCH" />
+ <!-- The folder InstallDirDlg edits. -->
+ <Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
+
+ <!-- First install / upgrade: Welcome -> Destination Folder -> Ready to install. A patch skips
+ the folder (it can't move an installed product). -->
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Condition="NOT Installed" />
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Condition="Installed AND PATCH" />
+
+ <!-- Destination Folder, as in WixUI_InstallDir: Next sets the folder, validates it (WiX's
+ WixUIValidatePath) and refuses one that can't be used; Change... opens the folder browser,
+ whose OK validates too. -->
+ <Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" />
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1" />
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath_$(sys.BUILDARCHSHORT)" Order="2"
+ Condition="NOT WIXUI_DONTVALIDATEPATH" />
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"
+ Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
+ <Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4"
+ Condition="WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID=&quot;1&quot;" />
+ <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1" />
+ <Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2" />
+ <Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath_$(sys.BUILDARCHSHORT)" Order="3"
+ Condition="NOT WIXUI_DONTVALIDATEPATH" />
+ <Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"
+ Condition="NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID&lt;&gt;&quot;1&quot;" />
+
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1"
+ Condition="NOT Installed" />
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3"
+ Condition="Installed AND PATCH" />
<!-- Maintenance: Welcome -> Repair / Remove -> Ready. -->
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg" />
@@ -131,6 +173,7 @@
</File>
<RegistryValue Root="HKLM" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\lightcraft.exe" Value="[#LightcraftExe]" Type="string" />
+ <RegistryValue Root="HKLM" Key="Software\LightCraft" Name="InstallFolder" Value="[INSTALLFOLDER]" Type="string" />
</Component>
<Component Id="LightcraftCli">