-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSI: Shouldn't silently associate file extensions with voxedit without asking the user first #521
Comments
EDIT: misunderstood - I thought this was about the file dialog - but this is about the MSI installer writing stuff into the registry. |
I installed it using an MSI, I don't think it asked me for association of the files at any point. |
To allow the user to choose whether to associate file types with Here’s how to update your WiX file: 1. Add a Custom Dialog for File AssociationsYou need to add a new dialog in the WiX installer to ask the user whether to associate the file types with your application. First, define the dialog in your WiX project: <UI>
<Dialog Id="DlgFileAssociations" Width="370" Height="270" Title="File Associations">
<Control Id="FileTypeLabel" Type="Text" X="20" Y="15" Width="330" Height="15" Text="Select the file types you want to associate with Vengi Voxel Editor:" />
<Control Id="VengiCheckBox" Type="CheckBox" X="40" Y="50" Width="200" Height="15" Text=".vengi files" Property="ASSOCIATE_VENGI" CheckBoxValue="1" />
<Control Id="AsepriteCheckBox" Type="CheckBox" X="40" Y="75" Width="200" Height="15" Text=".aseprite files" Property="ASSOCIATE_ASEPRITE" CheckBoxValue="1" />
<Control Id="OKButton" Type="PushButton" X="236" Y="243" Width="60" Height="17" Default="yes" Text="OK">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
</Dialog>
</UI> 2. Modify the Registry Entries to be ConditionalThe registry keys and ProgIds that associate the file extensions with For the <RegistryValue Root="HKLM" Key="Software\vengi-voxedit\Capabilities\FileAssociations" Name=".vengi" Value="vengi-voxedit.vengi" Type="string" Condition="ASSOCIATE_VENGI=1" />
<RegistryValue Root="HKCR" Key="Applications\vengi_voxedit.exe\SupportedTypes" Name=".vengi" Value="" Type="string" Condition="ASSOCIATE_VENGI=1" />
<RegistryValue Root="HKCR" Key=".vengi\OpenWithProgids" Name="vengi-voxedit.vengi" Value="" Type="string" Condition="ASSOCIATE_VENGI=1" />
<ProgId Id="vengi-voxedit.vengi" Description="Vengi" Icon="CM_FP_voxedit.voxedit.vengi_voxedit.exe" Condition="ASSOCIATE_VENGI=1">
<Extension Id="vengi" ContentType="application/x-vengi">
<Verb Id="open" TargetFile="CM_FP_voxedit.voxedit.vengi_voxedit.exe" Argument=""%1"" />
</Extension>
</ProgId> For the <RegistryValue Root="HKLM" Key="Software\vengi-voxedit\Capabilities\FileAssociations" Name=".aseprite" Value="vengi-voxedit.aseprite" Type="string" Condition="ASSOCIATE_ASEPRITE=1" />
<RegistryValue Root="HKCR" Key="Applications\vengi_voxedit.exe\SupportedTypes" Name=".aseprite" Value="" Type="string" Condition="ASSOCIATE_ASEPRITE=1" />
<RegistryValue Root="HKCR" Key=".aseprite\OpenWithProgids" Name="vengi-voxedit.aseprite" Value="" Type="string" Condition="ASSOCIATE_ASEPRITE=1" />
<ProgId Id="vengi-voxedit.aseprite" Description="aseprite" Icon="CM_FP_voxedit.voxedit.vengi_voxedit.exe" Condition="ASSOCIATE_ASEPRITE=1">
<Extension Id="aseprite" ContentType="application/x-aseprite">
<Verb Id="open" TargetFile="CM_FP_voxedit.voxedit.vengi_voxedit.exe" Argument=""%1"" />
</Extension>
</ProgId> 3. Integrate the Dialog into the Install SequenceTo display the file association dialog during installation, insert it into the sequence: <InstallUISequence>
<Show Dialog="DlgFileAssociations" Before="ProgressDlg">NOT Installed</Show>
</InstallUISequence> 4. Set Default Values for the PropertiesBy default, the file associations will be enabled (i.e., checkboxes checked), but users can uncheck them if they don't want the associations: <Property Id="ASSOCIATE_VENGI" Value="1" />
<Property Id="ASSOCIATE_ASEPRITE" Value="1" /> 5. Finalize the CMake WiX PatchThis example assumes you’ll modify your WiX patch XML accordingly. Ensure you generate the proper fragment or include it as part of the installation project so that the With these changes, during installation, users will be prompted with a dialog to accept or decline file type associations with |
<?xml version="1.0" encoding="UTF-8"?>
<CPackWiXPatch>
<!-- Your previous fragment entries here -->
<!-- Fragment to include a custom UI dialog -->
<CPackWiXFragment Id="CM_CP_CustomFileAssociationsDialog">
<!-- Define the custom dialog -->
<UI>
<Dialog Id="FileAssociationsDlg" Width="370" Height="270" Title="File Associations">
<Control Id="FileTypeLabel" Type="Text" X="20" Y="15" Width="330" Height="15" Text="Select the file types you want to associate with Vengi Voxel Editor:" />
<!-- Checkbox for file associations -->
<Control Id="VengiCheckBox" Type="CheckBox" X="40" Y="50" Width="200" Height="15" Text=".vengi files" Property="ASSOCIATE_VENGI" CheckBoxValue="1" />
<Control Id="AsepriteCheckBox" Type="CheckBox" X="40" Y="75" Width="200" Height="15" Text=".aseprite files" Property="ASSOCIATE_ASEPRITE" CheckBoxValue="1" />
<!-- OK button -->
<Control Id="OKButton" Type="PushButton" X="236" Y="243" Width="60" Height="17" Default="yes" Text="OK">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
</Dialog>
<!-- Integrate dialog into the UI flow -->
<InstallUISequence>
<!-- Show the file associations dialog before the install progress -->
<Show Dialog="FileAssociationsDlg" Before="ProgressDlg">NOT Installed</Show>
</InstallUISequence>
<!-- Default property values -->
<Property Id="ASSOCIATE_VENGI" Value="1" />
<Property Id="ASSOCIATE_ASEPRITE" Value="1" />
</UI>
</CPackWiXFragment>
</CPackWiXPatch>
|
No description provided.
The text was updated successfully, but these errors were encountered: