$PSScriptRoot compatibility

$PSScriptRoot is not available on PS version 2 or below.

So we'll set it ourselves.
This commit is contained in:
Martin Kemp 2015-05-19 15:44:32 +01:00
parent c38f6b3a89
commit c15e29ecb3

7
vendor/profile.ps1 vendored
View File

@ -1,4 +1,9 @@
# Add Cmder modules directory to the autoload path. # Compatibility with PS major versions <= 2
if(!$PSScriptRoot) {
$PSScriptRoot = Split-Path $Script:MyInvocation.MyCommand.Path
}
# Add Cmder modules directory to the autoload path.
$CmderModulePath = Join-path $PSScriptRoot "psmodules/" $CmderModulePath = Join-path $PSScriptRoot "psmodules/"
if( -not $env:PSModulePath.Contains($CmderModulePath) ){ if( -not $env:PSModulePath.Contains($CmderModulePath) ){