From 64343d8801e092fae99e868979e6414d98d7efce Mon Sep 17 00:00:00 2001 From: Iristyle Date: Mon, 8 Apr 2013 17:30:37 -0400 Subject: [PATCH] fix(SublimeText2.WebPackages): find node safer - use a fallback and write a warning when node.exe can't be found - try to use current PATH, then standard program files directory, then chocolatey bin root --- .../tools/chocolateyInstall.ps1 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/EthanBrown.SublimeText2.WebPackages/tools/chocolateyInstall.ps1 b/EthanBrown.SublimeText2.WebPackages/tools/chocolateyInstall.ps1 index f010e11..7a2d4e3 100644 --- a/EthanBrown.SublimeText2.WebPackages/tools/chocolateyInstall.ps1 +++ b/EthanBrown.SublimeText2.WebPackages/tools/chocolateyInstall.ps1 @@ -38,7 +38,19 @@ try { $linter = Join-Path $current $linterFileName $grunt = Join-Path $current $gruntFileName - $node = (Which node) + $nodeDefault = Join-Path $Env:ProgramFiles 'nodejs\node.exe' + $binRoot = Join-Path $Env:SystemDrive $Env:Chocolatey_Bin_Root + $node = (Which node), + $nodeDefault, + (Join-Path $binRoot 'nodejs\node.exe') | + ? { Test-Path $_ } | + Select -First 1 + if (!$node) + { + Write-Warning "Could not find NodeJS - using default $nodeDefault" + $node = $nodeDefault + } + $nodeRoot = Split-Path $node $escapedNode = $node -replace '\\', '\\'