Skip to content

Commit

Permalink
win,msi: correct installation path registry keys
Browse files Browse the repository at this point in the history
This is a port of 14db629.

Original commit message:

  Since install is per machine only, installation path should be stored
  in local machine instead of current user. The registry stores HKLM in
  different places for 32 and 64 bit applications, so the installer
  will not suggest the old path when upgrading from 32 to 64 bit
  version.

  Fixes nodejs/node-v0.x-archive#5592
  Fixes nodejs/node-v0.x-archive#25087

  PR-URL: nodejs/node-v0.x-archive#25640
  Reviewed-By: Alexis Campailla <[email protected]>
  Reviewed-By: Bert Belder <[email protected]>

PR-URL: #2565
Reviewed-By: Alexis Campailla <[email protected]>

Cherry picked to v3.x by @rvagg, PR:
  #2608
  • Loading branch information
joaocgreis authored and rvagg committed Aug 30, 2015
1 parent 752977b commit bb24c4a
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions tools/msvs/msi/product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@

<Property Id="INSTALLDIR">
<RegistrySearch Id="InstallPathRegistry"
Type="raw"
Root="HKLM"
Key="$(var.RegistryKeyPath)"
Name="InstallPath"/>
<!-- Also need to search under HKCU to support upgrading from old
versions. If we wanted to disable backward compatibility, this
second search could be deleted. -->
<RegistrySearch Id="InstallPathRegistryCU"
Type="raw"
Root="HKCU"
Key="$(var.RegistryKeyPath)"
Expand All @@ -47,8 +55,9 @@
Description="!(loc.NodeRuntime_Description)"
Absent="disallow">
<ComponentRef Id="NodeExecutable"/>
<ComponentRef Id="NodeRegistryEntries"/>
<ComponentRef Id="NodeVarsScript"/>
<ComponentRef Id="NodeStartMenuAndRegistryEntries"/>
<ComponentRef Id="NodeStartMenu"/>
<ComponentRef Id="AppData" />
<ComponentGroupRef Id="Product.Generated"/>

Expand Down Expand Up @@ -133,6 +142,20 @@
<RemoveFile Id="node.exe" Name="node.exe" On="both" />
</Component>

<Component Id="NodeRegistryEntries">
<RegistryValue Root="HKLM"
Key="$(var.RegistryKeyPath)"
Name="InstallPath"
Type="string"
Value="[INSTALLDIR]"
KeyPath="yes"/>
<RegistryValue Root="HKLM"
Key="$(var.RegistryKeyPath)"
Name="Version"
Type="string"
Value="$(var.ProductVersion)"/>
</Component>

<Component Id="NodeVarsScript">
<File Id="nodevars.bat" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\nodevars.bat"/>
</Component>
Expand All @@ -155,18 +178,15 @@
</DirectoryRef>

<DirectoryRef Id="ApplicationProgramsFolder">
<Component Id="NodeStartMenuAndRegistryEntries">
<Component Id="NodeStartMenu">
<!-- RegistryValue needed because every Component must have a KeyPath.
Because of ICE43, the Root must be HKCU. -->
<RegistryValue Root="HKCU"
Key="$(var.RegistryKeyPath)"
Name="InstallPath"
Type="string"
Value="[INSTALLDIR]"
Key="$(var.RegistryKeyPath)\Components"
Name="NodeStartMenuShortcuts"
Type="integer"
Value="1"
KeyPath="yes"/>
<RegistryValue Root="HKCU"
Key="$(var.RegistryKeyPath)"
Name="Version"
Type="string"
Value="$(var.ProductVersion)"/>
<Shortcut Id="NodeVarsScriptShortcut"
Name="io.js command prompt"
Target="[%ComSpec]"
Expand Down Expand Up @@ -292,10 +312,10 @@
</InstallUISequence>

<InstallExecuteSequence>
<Custom Action='SetInstallScope' Before='FindRelatedProducts'/>
<Custom Action="LinkNodeExeToIojsExe" After="InstallFiles">
$NodeAlias = 3
</Custom>
<Custom Action='SetInstallScope' Before='FindRelatedProducts'/>
<Custom Action='BroadcastEnvironmentUpdate' After='InstallFinalize'/>
</InstallExecuteSequence>

Expand Down

0 comments on commit bb24c4a

Please sign in to comment.