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
This commit is contained in:
@@ -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 '\\', '\\'
|
||||
|
Reference in New Issue
Block a user