Skip to content

Commit

Permalink
fix(decompress): '$ExtractDir' removed original extract file by accid…
Browse files Browse the repository at this point in the history
  • Loading branch information
niheaven authored and r15ch13 committed Jun 24, 2019
1 parent 2fafcb8 commit a882c4f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/decompress.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function Expand-MsiArchive {
movedir "$DestinationPath\SourceDir\$ExtractDir" $DestinationPath | Out-Null
Remove-Item "$DestinationPath\SourceDir" -Recurse -Force
} elseif ($ExtractDir) {
Get-ChildItem $DestinationPath -Exclude $ExtractDir | Remove-Item -Recurse -Force
Get-ChildItem $DestinationPath -Exclude $ExtractDir, $Path | Remove-Item -Recurse -Force
movedir "$DestinationPath\$ExtractDir" $DestinationPath | Out-Null
} elseif (Test-Path "$DestinationPath\SourceDir") {
movedir "$DestinationPath\SourceDir" $DestinationPath | Out-Null
Expand Down Expand Up @@ -236,7 +236,7 @@ function Expand-ZipArchive {
Microsoft.PowerShell.Archive\Expand-Archive -Path $Path -DestinationPath $DestinationPath -Force
}
if ($ExtractDir) {
Get-ChildItem $DestinationPath -Exclude $ExtractDir | Remove-Item -Recurse -Force
Get-ChildItem $DestinationPath -Exclude $ExtractDir, $Path | Remove-Item -Recurse -Force
movedir "$DestinationPath\$ExtractDir" $DestinationPath | Out-Null
}
if ($Removal) {
Expand Down Expand Up @@ -276,7 +276,7 @@ function Expand-DarkArchive {
Remove-Item $LogPath -Force
}
if ($ExtractDir) {
Get-ChildItem $DestinationPath -Exclude $ExtractDir | Remove-Item -Recurse -Force
Get-ChildItem $DestinationPath -Exclude $ExtractDir, $Path | Remove-Item -Recurse -Force
movedir "$DestinationPath\$ExtractDir" $DestinationPath | Out-Null
}
if ($Removal) {
Expand Down

0 comments on commit a882c4f

Please sign in to comment.