<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
   <Package
      Name="Rio"
      UpgradeCode="87c21c74-dbd5-4584-89d5-46d9cd0c40a8"
      Language="1033"
      Codepage="1252"
      Version="0.1.14"
      Manufacturer="Raphael Amorim"
      InstallerVersion="200">

      <MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
      <WixVariable Id="WixUILicenseRtf" Value=".\misc\windows\License.rtf" />
      <Icon Id="RioIcon" SourceFile=".\misc\windows\rio.ico" />
      <Property Id="APPRODUCTICON" Value="RioIcon" />
      <MediaTemplate EmbedCab="yes" />
      <ui:WixUI Id="WixUI_Minimal" />
      <Feature Id="ProductFeature" Title="ConsoleApp" Level="1">
         <ComponentRef Id="RioExe" />
         <ComponentRef Id="RioShortcut" />
         <ComponentRef Id="ModifyPathEnv" />
         <ComponentRef Id="ContextMenu" />
      </Feature>
      <!-- Application binaries -->
      <DirectoryRef Id="RioProgramFiles">
         <Component Id="RioExe">
            <File Id="RioExeFile" Source=".\target\release\rio.exe" Name="rio.exe" KeyPath="yes" />
         </Component>
      </DirectoryRef>
      <DirectoryRef Id="RioProgramMenu">
         <!-- Application shortcut -->
         <Component Id="RioShortcut" Guid="aa36e61a-23cd-4383-b744-2f78e912f0dc">
            <Shortcut Id="RioShortcutFile" Name="Rio" Description="A hardware-accelerated GPU terminal emulator" Target="[RioProgramFiles]rio.exe" Icon="RioIcon" />
            <RemoveFolder Id="RioProgramMenu" On="uninstall" />
            <RegistryValue Root="HKCU" Key="Software\Microsoft\Rio" Name="installed" Type="integer" Value="1" KeyPath="yes" />
         </Component>
      </DirectoryRef>
      <DirectoryRef Id="RioProgramFiles">
         <!-- Add to PATH -->
         <Component Id="ModifyPathEnv" Guid="edf0b679-9eb6-46f7-a5d1-5160f30acb34" KeyPath="yes">
            <Environment Id="PathEnv" Value="[RioProgramFiles]" Name="PATH" Permanent="no" Part="first" Action="set" System="yes" />
         </Component>
      </DirectoryRef>
      <StandardDirectory Id="ProgramFiles64Folder">
         <Directory Id="RioProgramFiles" Name="Rio" />
      </StandardDirectory>
      <StandardDirectory Id="ProgramMenuFolder">
         <Directory Id="RioProgramMenu" Name="Rio" />
      </StandardDirectory>
      <!-- Add context menu -->
      <Component Id="ContextMenu" Guid="449f9121-f7b9-41fe-82da-52349ea8ff91" Directory="TARGETDIR">
         <RegistryKey Root="HKCU" Key="Software\Classes\Directory\Background\shell\Open Rio here\command">
            <RegistryValue Type="string" Value='[RioProgramFiles]rio.exe --working-directory "%v"' KeyPath="yes" />
         </RegistryKey>
         <RegistryKey Root="HKCU" Key="Software\Classes\Directory\Background\shell\Open Rio here">
            <RegistryValue Type="string" Name="Icon" Value="[RioProgramFiles]rio.exe" />
         </RegistryKey>
      </Component>
   </Package>
</Wix>