Add an option to add KeePassXC to PATH during installation (#12171)

---------

Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
A2va
2025-09-10 02:27:09 +02:00
committed by GitHub
parent 05150e2483
commit 9a40182a62
2 changed files with 15 additions and 1 deletions

View File

@@ -24,6 +24,7 @@
<!-- Custom Controls for KPXC Installer -->
<Control Id="DesktopShortcutCheckBox" Type="CheckBox" X="20" Y="150" Width="290" Height="17" Property="INSTALLDESKTOPSHORTCUT" CheckBoxValue="1" Text="Create a shortcut on the desktop" />
<Control Id="AutostartCheckBox" Type="CheckBox" X="20" Y="170" Width="290" Height="17" Property="AUTOSTARTPROGRAM" CheckBoxValue="1" Text="Autostart KeePassXC on login" />
<Control Id="AddToPathCheckBox" Type="CheckBox" X="20" Y="190" Width="290" Height="17" Property="ADDTOPATH" CheckBoxValue="1" Text="Add KeePassXC to the PATH environment variable" />
</Dialog>
</UI>
</Fragment>

View File

@@ -56,6 +56,13 @@
<Condition>AUTOSTARTPROGRAM</Condition>
</Component>
<!-- Add KeePassXC to PATH -->
<Component Id="AddKeePassXCToPath" Guid="*" Directory="INSTALL_ROOT">
<Condition>ADDTOPATH</Condition>
<Environment Id="KeePassXCSystemPathEntryENV" Action="set" Part="last" Name="PATH" Value="[INSTALL_ROOT]" System="yes"/>
<RegistryValue Root="HKCU" Key="Software\KeePassXC" Name="AddedToPATH" Type="integer" Value="1" KeyPath="yes" />
</Component>
<DirectoryRef Id="TARGETDIR">
<!-- Startmenu shortcuts -->
<Directory Id="ProgramMenuFolder">
@@ -105,15 +112,21 @@
<RegistrySearch Id="AutoStartSearch" Root="HKCU" Key="Software\Microsoft\Windows\CurrentVersion\Run" Name="$(var.CPACK_PACKAGE_NAME)" Type="raw" />
</Property>
<Property Id="INSTALLDESKTOPSHORTCUT" Secure="yes" />
<Property Id="ADDTOPATH" Value="1" Secure="yes" />
<Property Id="ADDTOPATH_REGISTRY">
<RegistrySearch Id="AddToPathSearch" Root="HKCU" Key="Software\KeePassXC" Name="AddedToPATH" Type="raw" />
</Property>
<!-- Set properties based on existing conditions, prevents changing state on upgrade -->
<SetProperty Id="AUTOSTARTPROGRAM" After="AppSearch" Value="">AUTOSTARTPROGRAM="0" OR (WIX_UPGRADE_DETECTED AND NOT AUTOSTARTPROGRAM_REGISTRY)</SetProperty>
<SetProperty Id="AUTOSTARTPROGRAM" After="AppSearch" Value="" Sequence="first">AUTOSTARTPROGRAM="0" OR (WIX_UPGRADE_DETECTED AND NOT AUTOSTARTPROGRAM_REGISTRY)</SetProperty>
<SetProperty Id="ADDTOPATH" After="AppSearch" Value="" Sequence="first">ADDTOPATH="0" OR (WIX_UPGRADE_DETECTED AND NOT ADDTOPATH_REGISTRY)</SetProperty>
<SetProperty Id="LicenseAccepted" After="AppSearch" Value="1">WIX_UPGRADE_DETECTED</SetProperty>
<FeatureRef Id="ProductFeature">
<ComponentRef Id="ApplicationShortcuts" />
<ComponentRef Id="Autostart" />
<ComponentRef Id="DesktopShortcut" />
<ComponentRef Id="AddKeePassXCToPath"/>
</FeatureRef>
<!-- Action to launch application after installer exits -->