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:
Iristyle
2013-04-08 17:54:02 -04:00
parent c838a22777
commit 2efc0f5ad6

View File

@@ -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 '\\', '\\'