cad-editor/packaging/windows/main.wxs
Hakan Seven e7afe35d62 feat(packaging): desktop shortcut, icon-cache refresh, checksums, AppStream
Windows installer:
- Optional Desktop shortcut feature (default on, deselectable) via a switch to
  the WixUI_FeatureTree UI.
- Refresh the shell after install (ie4uinit -show) so .dwg/.dxf icons and
  associations appear without a reboot.
- Tidy the Add/Remove Programs entry: ARPNOREPAIR plus contact/update/comments
  metadata (Modify stays enabled for the feature tree).

Release workflow:
- Publish SHA256 sidecars for the AppImage, portable .exe, MSI and .dmg.

Linux:
- Ship an AppStream metainfo.xml for software-centre integration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-16 04:27:46 +03:00

272 lines
11 KiB
XML

<?xml version='1.0' encoding='windows-1252'?>
<!--
WiX source for the Windows MSI installer.
Build (CI / locally with WiX Toolset 3.x in PATH):
candle.exe -arch x64 -dVersion=<x.y.z> -dSource=target\release\OpenCADStudio.exe \
-dIcon=packaging\windows\AppIcon.ico packaging\windows\main.wxs \
-out packaging\windows\main.wixobj
light.exe packaging\windows\main.wixobj -ext WixUIExtension -out OpenCADStudio.msi
Provides:
* Per-machine install under Program Files\Open CAD Studio.
* Start Menu shortcut under Programs\Open CAD Studio.
* Desktop shortcut.
* File associations for .dwg and .dxf via a single ProgID; both
route through `OpenCADStudio.exe "%1"` so the OS hands the file
path to the app as argv[1] (consumed in OpenCADStudio::boot).
* Default Programs registration (Capabilities + RegisteredApplications)
so the app shows up in Settings > Default Apps and can be set as the
default handler for .dwg / .dxf.
* Standard Add/Remove Programs entry with icon.
* MajorUpgrade — installing a newer MSI replaces the old version.
-->
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Product
Id='*'
Name='Open CAD Studio'
UpgradeCode='bd6bceab-6c7a-4ce2-a62d-6ef06a92f8b1'
Manufacturer='Hakan Seven'
Language='1033'
Codepage='1252'
Version='$(var.Version)'>
<Package
Id='*'
Keywords='Installer'
Description='Open CAD Studio Installer'
Manufacturer='Hakan Seven'
InstallerVersion='450'
Languages='1033'
Compressed='yes'
InstallScope='perMachine'
SummaryCodepage='1252' />
<MajorUpgrade
Schedule='afterInstallInitialize'
DowngradeErrorMessage='A newer version of [ProductName] is already installed. Setup will now exit.' />
<Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
<Icon Id='AppIcon.ico' SourceFile='$(var.Icon)' />
<Property Id='ARPPRODUCTICON' Value='AppIcon.ico' />
<Property Id='ARPHELPLINK' Value='https://github.com/HakanSeven12/OpenCADStudio' />
<Property Id='ARPURLINFOABOUT' Value='https://github.com/HakanSeven12/OpenCADStudio' />
<Property Id='ARPURLUPDATEINFO' Value='https://github.com/HakanSeven12/OpenCADStudio/releases' />
<Property Id='ARPCONTACT' Value='Hakan Seven' />
<Property Id='ARPCOMMENTS' Value='2D/3D CAD application for DWG and DXF drawings.' />
<!--
Hide "Repair" from the Apps & Features entry — there is no repair flow.
"Modify" is deliberately left enabled: WixUI_FeatureTree supports it, so
users can add/remove the optional Desktop shortcut feature later.
-->
<Property Id='ARPNOREPAIR' Value='1' />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFiles64Folder'>
<Directory Id='APPLICATIONROOTDIRECTORY' Name='Open CAD Studio'>
<Component Id='MainExecutable' Guid='2900c116-e9a5-4650-8a4c-48c0987d1a33' Win64='yes'>
<File
Id='OpenCADStudioEXE'
Name='OpenCADStudio.exe'
DiskId='1'
Source='$(var.Source)'
KeyPath='yes'>
<Shortcut
Id='StartMenuShortcut'
Directory='ProgramMenuDir'
Name='Open CAD Studio'
Description='Launch Open CAD Studio'
WorkingDirectory='APPLICATIONROOTDIRECTORY'
Icon='AppIcon.ico'
IconIndex='0'
Advertise='yes' />
</File>
<!--
File associations. Two ProgIDs (one per extension) so the
`<Verb Id='open'>` rows don't collide on the same registry
primary key — both ProgIDs invoke the same exe with the
file path as `argv[1]`.
-->
<ProgId
Id='OpenCADStudio.DWG'
Description='DWG Drawing'
Icon='OpenCADStudioEXE'
IconIndex='0'>
<Extension Id='dwg' ContentType='image/vnd.dwg'>
<Verb Id='open' Command='Open' TargetFile='OpenCADStudioEXE' Argument='"%1"' />
</Extension>
</ProgId>
<ProgId
Id='OpenCADStudio.DXF'
Description='DXF Drawing'
Icon='OpenCADStudioEXE'
IconIndex='0'>
<Extension Id='dxf' ContentType='image/vnd.dxf'>
<Verb Id='open' Command='Open' TargetFile='OpenCADStudioEXE' Argument='"%1"' />
</Extension>
</ProgId>
</Component>
<!--
Default Programs registration. The ProgId/Extension rows above
register the handlers, but modern Windows (8+) guards the actual
default via a per-user UserChoice hash an installer can't forge.
Publishing Capabilities + a RegisteredApplications entry is the
supported way in: it makes Open CAD Studio appear in Settings >
Default Apps and the "Open with" list, so .dwg / .dxf can be set
to it. The keys are HKLM-wide, so the shell picks them up on its
next association query without a forced refresh.
-->
<Component Id='DefaultPrograms' Guid='6f3e9b2a-1c4d-4f8a-9b7e-2d5a8c1f0e63' Win64='yes'>
<!--
Applications\<exename>\DefaultIcon is what Windows shows in the
"Open with" context-menu list and "Choose another app" picker.
Without it the entry appears with a blank generic document icon.
-->
<RegistryValue
Root='HKLM'
Key='SOFTWARE\Classes\Applications\OpenCADStudio.exe\DefaultIcon'
Type='string'
Value='[APPLICATIONROOTDIRECTORY]OpenCADStudio.exe,0'
KeyPath='yes' />
<RegistryValue
Root='HKLM'
Key='SOFTWARE\Classes\Applications\OpenCADStudio.exe'
Name='FriendlyAppName'
Type='string'
Value='Open CAD Studio' />
<RegistryValue
Root='HKLM'
Key='SOFTWARE\Classes\Applications\OpenCADStudio.exe\shell\open\command'
Type='string'
Value='"[APPLICATIONROOTDIRECTORY]OpenCADStudio.exe" "%1"' />
<RegistryValue
Root='HKLM'
Key='SOFTWARE\Classes\Applications\OpenCADStudio.exe\SupportedTypes'
Name='.dwg'
Type='string'
Value='' />
<RegistryValue
Root='HKLM'
Key='SOFTWARE\Classes\Applications\OpenCADStudio.exe\SupportedTypes'
Name='.dxf'
Type='string'
Value='' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities'
Name='ApplicationName'
Type='string'
Value='Open CAD Studio' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities'
Name='ApplicationDescription'
Type='string'
Value='2D/3D CAD application for DWG and DXF drawings.' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities\FileAssociations'
Name='.dwg'
Type='string'
Value='OpenCADStudio.DWG' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities\FileAssociations'
Name='.dxf'
Type='string'
Value='OpenCADStudio.DXF' />
<RegistryValue
Root='HKLM'
Key='Software\RegisteredApplications'
Name='Open CAD Studio'
Type='string'
Value='Software\Open CAD Studio\Capabilities' />
</Component>
</Directory>
</Directory>
<Directory Id='ProgramMenuFolder'>
<Directory Id='ProgramMenuDir' Name='Open CAD Studio'>
<Component Id='ProgramMenuDirComp' Guid='34a788ba-f9d4-4e73-b1ff-9eb8749b369e'>
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue
Root='HKCU'
Key='Software\Open CAD Studio'
Name='installed'
Type='integer'
Value='1'
KeyPath='yes' />
</Component>
</Directory>
</Directory>
<!--
Desktop shortcut. A non-advertised shortcut with an explicit Target;
the HKCU registry value is the component KeyPath (a shortcut on its own
cannot be a KeyPath for a per-user resource).
-->
<Directory Id='DesktopFolder' Name='Desktop'>
<Component Id='DesktopShortcutComp' Guid='c5c7f1c4-3d8a-4efd-b049-4662d9143dcd'>
<Shortcut
Id='DesktopShortcut'
Name='Open CAD Studio'
Description='Launch Open CAD Studio'
Target='[APPLICATIONROOTDIRECTORY]OpenCADStudio.exe'
WorkingDirectory='APPLICATIONROOTDIRECTORY'
Icon='AppIcon.ico'
IconIndex='0' />
<RegistryValue
Root='HKCU'
Key='Software\Open CAD Studio'
Name='desktop_shortcut'
Type='integer'
Value='1'
KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Feature Id='Complete' Title='Open CAD Studio' Level='1' Display='expand'>
<ComponentRef Id='MainExecutable' />
<ComponentRef Id='DefaultPrograms' />
<ComponentRef Id='ProgramMenuDirComp' />
<!-- Optional, user-deselectable in the feature tree (default on). -->
<Feature
Id='DesktopShortcut'
Title='Desktop shortcut'
Description='Add a shortcut to Open CAD Studio on the desktop.'
Level='1'
Absent='allow'>
<ComponentRef Id='DesktopShortcutComp' />
</Feature>
</Feature>
<!--
Refresh the shell after install so the new .dwg / .dxf file-type icons
and associations appear immediately instead of only after a reboot or an
icon-cache rebuild. `ie4uinit -show` rebuilds the per-user icon cache.
Immediate execution keeps property access ([SystemFolder]); Return='ignore'
means it can never fail the install, and the NOT REMOVE condition skips it
on uninstall.
-->
<CustomAction
Id='RefreshShellIcons'
Directory='APPLICATIONROOTDIRECTORY'
ExeCommand='"[SystemFolder]ie4uinit.exe" -show'
Execute='immediate'
Return='ignore' />
<InstallExecuteSequence>
<Custom Action='RefreshShellIcons' After='InstallFinalize'>NOT REMOVE</Custom>
</InstallExecuteSequence>
<!-- Installer UI + finish-screen launch checkbox (see ui.wxs). -->
<UIRef Id='OpenCADStudioUI' />
</Product>
</Wix>