mirror of
https://github.com/cmderdev/cmder.git
synced 2025-02-11 16:00:21 +08:00
merging in new additions to the pull request
This commit is contained in:
commit
cf74dba780
@ -74,6 +74,14 @@ function Flatten-Directory ($name) {
|
|||||||
Remove-Item -Recurse "$($name)_moving"
|
Remove-Item -Recurse "$($name)_moving"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Extract-Archive ($source, $target) {
|
||||||
|
Invoke-Expression "7z x -y -o$($target) $source"
|
||||||
|
if ($lastexitcode -ne 0) {
|
||||||
|
Write-Error "Extracting of $source failied"
|
||||||
|
}
|
||||||
|
Remove-Item $source
|
||||||
|
}
|
||||||
|
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
# Check for requirements
|
# Check for requirements
|
||||||
@ -92,8 +100,7 @@ foreach ($s in $sources) {
|
|||||||
Delete-Existing $s.name
|
Delete-Existing $s.name
|
||||||
|
|
||||||
Invoke-WebRequest -Uri $s.url -OutFile $tempArchive -ErrorAction Stop
|
Invoke-WebRequest -Uri $s.url -OutFile $tempArchive -ErrorAction Stop
|
||||||
Invoke-Expression "7z x -y -o$($s.name) $tempArchive > `$null"
|
Extract-Archive $tempArchive $s.name
|
||||||
Remove-Item $tempArchive
|
|
||||||
|
|
||||||
if ((Get-Childitem $s.name).Count -eq 1) {
|
if ((Get-Childitem $s.name).Count -eq 1) {
|
||||||
Flatten-Directory($s.name)
|
Flatten-Directory($s.name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user