You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Should error if the specified destination is not present
55
59
[string]$Destination=Resolve-Path$Destination
56
60
57
-
if ($defaultRepoPath-ne$Destination) {
58
-
if (-not$NoProfileUpdate) {
59
-
Write-Warning'Parameter -Destination is set to a custom path. We assume you know what you are doing, so it will not automatically be added to your Profile but will be added to PSModulePath. Set -NoProfileUpdate to suppress this message in the future.'
60
-
}
61
-
$NoProfileUpdate=$true
62
-
}
63
61
if (-not$NoPSModulePathUpdate) {
62
+
if ($defaultRepoPath-ne$Destination-and$Destination-notin$PSModulePaths) {
63
+
Write-Warning'Parameter -Destination is set to a custom path not in your current PSModulePath. We will add it to your PSModulePath for this session. You can suppress this behavior with the -NoPSModulePathUpdate switch.'
[string]$profileLine="if ('$destination' -notin (`$env:PSModulePath -split [Path]::PathSeparator)) { `$env:PSModulePath += `$([IO.Path]::PathSeparator + '$Destination') } #Added by ModuleFast. DO NOT EDIT THIS LINE. If you do not want this, add -NoProfileUpdate to Install-ModuleFast."
1121
+
[string]$profileLine="if ('$Destination' -notin (`$env:PSModulePath.split([IO.Path]::PathSeparator))) { `$env:PSModulePath = '$Destination' + `$([IO.Path]::PathSeparator + '$Destination') } #Added by ModuleFast. DO NOT EDIT THIS LINE. If you do not want this, add -NoProfileUpdate to Install-ModuleFast or add the default destination to your powershell.config.json or to your PSModulePath another way."
1136
1122
if ((Get-Content-Raw $myProfile) -notmatch [Regex]::Escape($ProfileLine)) {
1137
-
if (-not$PSCmdlet.ShouldProcess($myProfile,"Allow ModuleFast to work by adding $Destination to your PSModulePath on startup by appending to your CurrentUserAllHosts profile.")) { return }
1123
+
if (-not$PSCmdlet.ShouldProcess($myProfile,"Allow ModuleFast to work by adding $Destination to your PSModulePath on startup by appending to your CurrentUserAllHosts profile. If you do not want this, add -NoProfileUpdate to Install-ModuleFast or add the specified destination to your powershell.config.json or to your PSModulePath another way.")) { return }
1138
1124
Write-Verbose"Adding $Destination to profile $myProfile"
1139
1125
Add-Content-Path $myProfile-Value "`n`n"
1140
1126
Add-Content-Path $myProfile-Value $ProfileLine
@@ -1338,7 +1324,6 @@ function ConvertTo-AuthenticationHeaderValue ([PSCredential]$Credential) {
0 commit comments