Merge pull request #13751 from aspnet/MattGal-patch-1
Add -Force to Expand-Archive
This commit is contained in:
commit
e7016bc67a
|
|
@ -48,9 +48,10 @@ Write-Host "Extracting to $tempDir"
|
||||||
|
|
||||||
if (Get-Command -Name 'Microsoft.PowerShell.Archive\Expand-Archive' -ErrorAction Ignore) {
|
if (Get-Command -Name 'Microsoft.PowerShell.Archive\Expand-Archive' -ErrorAction Ignore) {
|
||||||
# Use built-in commands where possible as they are cross-plat compatible
|
# Use built-in commands where possible as they are cross-plat compatible
|
||||||
Microsoft.PowerShell.Archive\Expand-Archive -Path "nodejs.zip" -DestinationPath $tempDir
|
Microsoft.PowerShell.Archive\Expand-Archive -Path "nodejs.zip" -DestinationPath $tempDir -Force
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Remove-Item $tempDir -Recurse -ErrorAction Ignore
|
||||||
# Fallback to old approach for old installations of PowerShell
|
# Fallback to old approach for old installations of PowerShell
|
||||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("nodejs.zip", $tempDir)
|
[System.IO.Compression.ZipFile]::ExtractToDirectory("nodejs.zip", $tempDir)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue