fix(SublimeText2.UtilPackages): default ps paths
- When searching for Powershell, be more resilient, search on disk for known locations and fallback to sensible default
This commit is contained in:
@@ -23,7 +23,18 @@ try {
|
|||||||
$sublimeFiles = Join-Path (Get-CurrentDirectory) $sublimeFilesFileName
|
$sublimeFiles = Join-Path (Get-CurrentDirectory) $sublimeFilesFileName
|
||||||
|
|
||||||
# TODO: this doesn't actually work in the Sublime plugin right now, but might in the future
|
# TODO: this doesn't actually work in the Sublime plugin right now, but might in the future
|
||||||
$ps = (Which powershell)
|
$systemPath = [Environment]::GetFolderPath('System')
|
||||||
|
$psDefault = Join-Path $systemPath 'WindowsPowerShell\v1.0\powershell.exe'
|
||||||
|
$ps = (Which powershell),
|
||||||
|
$psDefault |
|
||||||
|
? { Test-Path $_ } |
|
||||||
|
Select -First 1
|
||||||
|
if (!$ps)
|
||||||
|
{
|
||||||
|
Write-Warning "Could not find Powershell - using default $psDefault"
|
||||||
|
$ps = $psDefault
|
||||||
|
}
|
||||||
|
|
||||||
$psRoot = Split-Path $ps
|
$psRoot = Split-Path $ps
|
||||||
|
|
||||||
$escapedPs = $ps -replace '\\', '\\'
|
$escapedPs = $ps -replace '\\', '\\'
|
||||||
|
Reference in New Issue
Block a user