mirror of
https://github.com/cmderdev/cmder.git
synced 2024-11-10 17:59:11 +08:00
Merge pull request #1441 from pyranja/fix-psget-clobbering
Avoid clobbering Install-Module
This commit is contained in:
commit
8077c1a612
6
vendor/profile.ps1
vendored
6
vendor/profile.ps1
vendored
@ -17,10 +17,14 @@ if(!$PSScriptRoot) {
|
|||||||
$PSScriptRoot = Split-Path $Script:MyInvocation.MyCommand.Path
|
$PSScriptRoot = Split-Path $Script:MyInvocation.MyCommand.Path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# do not load bundled psget if a module installer is already available
|
||||||
|
# -> recent PowerShell versions include PowerShellGet out of the box
|
||||||
|
$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue | Out-Null)
|
||||||
|
|
||||||
# Add Cmder modules directory to the autoload 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 $moduleInstallerAvailable -and -not $env:PSModulePath.Contains($CmderModulePath) ){
|
||||||
$env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;")
|
$env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user