Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions ModuleFast.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,18 @@ function Install-ModuleFast {
)
begin {
trap {$PSCmdlet.ThrowTerminatingError($PSItem)}



#Clear the ModuleFastCache if -Update is specified to ensure fresh lookups of remote module availability
if ($Update) {
Clear-ModuleFastCache
}

#Cleanup that allows for shorthand such as pwsh.gallery
[Uri]$srcTest = $Source
if ($srcTest.Scheme -notin 'http', 'https') {
Write-Debug "Appending https and index.json to $Source"
$Source = "https://$Source/index.json"
}

$defaultRepoPath = $(Join-Path ([Environment]::GetFolderPath('LocalApplicationData')) 'powershell/Modules')
if (-not $Destination) {
#Special function that will retrieve the default module path for the current user
Expand All @@ -279,6 +283,8 @@ function Install-ModuleFast {
throw 'Failed to determine destination path. This is a bug, please report it, it should always have something by this point.'
}



# Require approval to create the destination folder if it is not our default path, otherwise this is automatic
if (-not (Test-Path $Destination)) {
if ($configRepoPath -or
Expand Down