Skip to content

Commit 42c31f4

Browse files
committed
win,msi: link node.exe to iojs.exe
Add a feature to the MSI installer that, when selected, hard-links node.exe to iojs.exe. PR: #346 Reviewed-by: Fedor Indutny <[email protected]> Reviewed-by: Rod Vagg <[email protected]>
1 parent 01736dd commit 42c31f4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tools/msvs/msi/product.wxs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
<ComponentRef Id="AppData" />
5050
<ComponentGroupRef Id="Product.Generated"/>
5151

52+
<Feature Id="NodeAlias"
53+
Level="1"
54+
Title="Alias node to iojs"
55+
Description="Create node.exe as an alias for iojs.exe.">
56+
<ComponentRef Id="NodeAlias"/>
57+
</Feature>
58+
5259
<Feature Id="NodePerfCtrSupport"
5360
Level="1"
5461
Title="Performance counters"
@@ -117,6 +124,12 @@
117124
<File Id="iojs.exe" KeyPath="yes" Source="$(var.SourceDir)\iojs.exe"/>
118125
</Component>
119126

127+
<Component Id="NodeAlias" Guid="fde09cce-a503-4409-a3c4-61ae2a5a5906">
128+
<!-- Always remove node.exe. The hard link will be recreated by the
129+
`LinkNodeExeToIojsExe` custom action whenever needed. -->
130+
<RemoveFile Id="node.exe" Name="node.exe" On="both" />
131+
</Component>
132+
120133
<Component Id="NodeVarsScript">
121134
<File Id="nodevars.bat" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\nodevars.bat"/>
122135
</Component>
@@ -249,6 +262,19 @@
249262
</Component>
250263
</DirectoryRef>
251264

265+
<CustomAction Id="LinkNodeExeToIojsExe"
266+
FileKey="iojs.exe"
267+
ExeCommand="-e &quot; require('fs').linkSync(process.execPath, require('path').resolve(process.execPath, '../node.exe')); &quot;"
268+
Impersonate="no"
269+
Execute="deferred"
270+
Return="check" />
271+
272+
<InstallExecuteSequence>
273+
<Custom Action="LinkNodeExeToIojsExe" After="InstallFiles">
274+
$NodeAlias = 3
275+
</Custom>
276+
</InstallExecuteSequence>
277+
252278
<UI Id="NodeInstallUI">
253279
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8"/>
254280
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12"/>

0 commit comments

Comments
 (0)