fix(windows): add DefaultIcon to Applications entry so "Open with" icon shows

Both the MSI and the portable build were missing Applications\OpenCADStudio.exe\
DefaultIcon, causing a blank generic icon in the "Open with" context-menu list
and the "Choose another app" picker.

- packaging/windows/main.wxs: add Applications\OpenCADStudio.exe\DefaultIcon
  (+ FriendlyAppName, shell\open\command, SupportedTypes) to the
  DefaultPrograms component for MSI installs (HKLM).

- src/io/file_association.rs: add DefaultIcon to the Applications\
  OpenCADStudio.exe block written at runtime for portable builds (HKCU).

https://claude.ai/code/session_01DFVSKgViFaxEjZD2KsTdtt
This commit is contained in:
Claude 2026-06-12 11:42:41 +00:00
commit 13eef50a00
No known key found for this signature in database
2 changed files with 40 additions and 2 deletions

View file

@ -112,13 +112,48 @@
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'
Name=''
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'
Name=''
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'
KeyPath='yes' />
Value='Open CAD Studio' />
<RegistryValue
Root='HKLM'
Key='Software\Open CAD Studio\Capabilities'

View file

@ -264,6 +264,9 @@ mod windows_impl {
&format!("\"{exe}\" \"%1\""),
)?;
set_string(APP_BASE, Some("FriendlyAppName"), "Open CAD Studio")?;
// DefaultIcon is what Windows uses to show the app icon in the
// "Open with" context-menu list and the "Choose another app" picker.
set_string(&format!(r"{APP_BASE}\DefaultIcon"), None, &format!("\"{exe}\",0"))?;
// Listing the extensions under SupportedTypes is what makes the app
// appear in the "Open with → Choose another app" picker for them.
set_string(&format!(r"{APP_BASE}\SupportedTypes"), Some(".dwg"), "")?;