Skip to content

Commit 238efee

Browse files
committed
Use correct temp path
1 parent 9189f8d commit 238efee

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

ModuleFast.ps1

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ function Install-ModuleFast {
381381
param(
382382
$ModulesToInstall,
383383
$Destination,
384-
$ModuleCache = (New-Item -ItemType Directory -Force -Path (Join-Path ([io.path]::GetTempPath()) 'ModuleFastCache')),
385-
$NuGetCache = $(Join-Path $env:TEMP 'ModuleFastCache'),
384+
$ModuleCache = $(New-Item -ItemType Directory -Force -Path Temp:\ModuleFastCache),
386385
[Switch]$Force,
387386
#By default will modify your PSModulePath to use the builtin destination if not present. Setting this implicitly skips profile update as well.
388387
[Switch]$NoPSModulePathUpdate,
@@ -427,7 +426,7 @@ function Install-ModuleFast {
427426
ModuleToInstall = $plan
428427
Destination = $Destination
429428
CancellationToken = $cancelSource.Token
430-
NuGetCache = $NuGetCache
429+
ModuleCache = $ModuleCache
431430
HttpClient = $httpClient
432431
}
433432
Install-ModuleFastHelper @installHelperParams
@@ -440,7 +439,7 @@ function Install-ModuleFastHelper {
440439
param(
441440
[ModuleFastSpec[]]$ModuleToInstall,
442441
[string]$Destination,
443-
[string]$NuGetCache,
442+
[string]$ModuleCache,
444443
[CancellationToken]$CancellationToken,
445444
[HttpClient]$HttpClient
446445
)
@@ -455,7 +454,7 @@ function Install-ModuleFastHelper {
455454
#TODO: Check file health and integrity. If it's good, skip the download and move on to install process.
456455
$context = @{
457456
Module = $module
458-
DownloadPath = Join-Path $NuGetCache "$($module.Name).$($module.Version).nupkg"
457+
DownloadPath = Join-Path $ModuleCache "$($module.Name).$($module.Version).nupkg"
459458
}
460459
$fetchTask = $httpClient.GetStreamAsync($module.DownloadLink, $CancellationToken)
461460
$taskMap.Add($fetchTask, $context)
@@ -561,7 +560,7 @@ function Install-ModuleFastOperation {
561560
# $ModulePackageName = @($ModuleItem.Id, $ModuleItem.Version, 'nupkg') -join '.'
562561
# $ModuleCachePath = [io.path]::Combine(
563562
# [string[]](
564-
# $NuGetCache,
563+
# $ModuleCache,
565564
# $ModuleItem.Id,
566565
# $ModuleItem.Version,
567566
# $ModulePackageName
@@ -633,7 +632,7 @@ function Install-ModuleFastOperation {
633632
# $moduleCount = $modulestoinstall.id.count
634633
# $ipackage = 0
635634
# #Initialize the files in the repository, if relevant
636-
# & nuget.exe init $ModuleCache $NugetCache | Where-Object { $PSItem -match 'already exists|installing' } | ForEach-Object {
635+
# & nuget.exe init $ModuleCache $ModuleCache | Where-Object { $PSItem -match 'already exists|installing' } | ForEach-Object {
637636
# if ($ipackage -lt $modulecount) { $ipackage++ }
638637
# #Write-Progress has a performance issue if run too frequently
639638
# if ($timer.elapsedmilliseconds -gt 200) {
@@ -654,7 +653,7 @@ function Install-ModuleFastOperation {
654653
# foreach ($moduleItem in $modulesToInstall) {
655654
# $moduleRelativePath = [io.path]::Combine($ModuleItem.id, $moduleitem.version)
656655
# #nuget saves as lowercase, matching to avoid Linux case issues
657-
# $moduleNugetPath = (Join-Path $NugetCache $moduleRelativePath).tolower()
656+
# $moduleNugetPath = (Join-Path $ModuleCache $moduleRelativePath).tolower()
658657
# $moduleTargetPath = Join-Path $Path $moduleRelativePath
659658

660659
# if (-not (Test-Path $moduleNugetPath)) { Write-Error "$moduleNugetPath doesn't exist"; continue }

0 commit comments

Comments
 (0)