@@ -626,8 +626,7 @@ function Test-FileChecksum {
626
626
function Expand-AspireCliArchive {
627
627
param (
628
628
[string ]$ArchiveFile ,
629
- [string ]$DestinationPath ,
630
- [string ]$OS
629
+ [string ]$DestinationPath
631
630
)
632
631
633
632
Write-Message " Unpacking archive to: $DestinationPath " - Level Verbose
@@ -639,16 +638,14 @@ function Expand-AspireCliArchive {
639
638
New-Item - ItemType Directory - Path $DestinationPath - Force | Out-Null
640
639
}
641
640
642
- if ($OS -eq " win" ) {
643
- # Use Expand-Archive for ZIP files on Windows
641
+ if ($ArchiveFile -match " \.zip$" ) {
644
642
if (-not (Get-Command Expand-Archive - ErrorAction SilentlyContinue)) {
645
643
throw " Expand-Archive cmdlet not found. Please use PowerShell 5.0 or later to extract ZIP files."
646
644
}
647
645
648
646
Expand-Archive - Path $ArchiveFile - DestinationPath $DestinationPath - Force
649
647
}
650
- else {
651
- # Use tar for tar.gz files on Unix systems
648
+ elseif ($ArchiveFile -match " \.tar\.gz$" ) {
652
649
if (-not (Get-Command tar - ErrorAction SilentlyContinue)) {
653
650
throw " tar command not found. Please install tar to extract tar.gz files."
654
651
}
@@ -657,11 +654,17 @@ function Expand-AspireCliArchive {
657
654
try {
658
655
Set-Location $DestinationPath
659
656
& tar - xzf $ArchiveFile
657
+ if ($LASTEXITCODE -ne 0 ) {
658
+ throw " Failed to extract tar.gz archive: $ArchiveFile . tar command returned exit code $LASTEXITCODE "
659
+ }
660
660
}
661
661
finally {
662
662
Set-Location $currentLocation
663
663
}
664
664
}
665
+ else {
666
+ throw " Unsupported archive format: $ArchiveFile . Only .zip and .tar.gz files are supported."
667
+ }
665
668
666
669
Write-Message " Successfully unpacked archive" - Level Verbose
667
670
}
@@ -715,7 +718,7 @@ function Get-InstallPath {
715
718
throw " Unable to determine user home directory. Please specify -InstallPath parameter."
716
719
}
717
720
718
- $defaultPath = Join-Path ( Join-Path $homeDirectory " .aspire" ) " bin "
721
+ $defaultPath = Join-Path $homeDirectory " .aspire"
719
722
return [System.IO.Path ]::GetFullPath($defaultPath )
720
723
}
721
724
@@ -875,7 +878,7 @@ function Install-AspireCli {
875
878
876
879
if ($PSCmdlet.ShouldProcess ($InstallPath , " Install CLI" )) {
877
880
# Unpack the archive
878
- Expand-AspireCliArchive - ArchiveFile $archivePath - DestinationPath $InstallPath - OS $targetOS
881
+ Expand-AspireCliArchive - ArchiveFile $archivePath - DestinationPath $InstallPath
879
882
880
883
$cliExe = if ($targetOS -eq " win" ) { " aspire.exe" } else { " aspire" }
881
884
$cliPath = Join-Path $InstallPath $cliExe
0 commit comments