mirror of
https://github.com/timsutton/brigadier.git
synced 2025-06-06 17:51:22 -04:00
Stop download if final destination exists
Python automatically deletes it, but that seems unwise? Warn instead.
This commit is contained in:
parent
51c0e0c301
commit
5d0b7dff4e
1 changed files with 6 additions and 1 deletions
|
@ -62,7 +62,11 @@ $packagePath = Join-Path $workingDir 'BootCampESD.pkg'
|
||||||
$payloadPath = Join-Path $workingDir 'Payload~'
|
$payloadPath = Join-Path $workingDir 'Payload~'
|
||||||
$dmgPath = Join-Path $workingDir 'WindowsSupport.dmg'
|
$dmgPath = Join-Path $workingDir 'WindowsSupport.dmg'
|
||||||
|
|
||||||
if (-not (Test-Path -PathType Container $landingDir)) {mkdir $landingDir > $null}
|
if (Test-Path -PathType Container $landingDir) {
|
||||||
|
# Python just deletes the folder
|
||||||
|
Write-Warning "Final destination folder $landingDir already exists, please remove it to redownload."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
if (-not (Test-Path -PathType Container $workingDir)) {mkdir $workingDir > $null}
|
if (-not (Test-Path -PathType Container $workingDir)) {mkdir $workingDir > $null}
|
||||||
|
|
||||||
Write-Host "Starting download from $($package.URL)"
|
Write-Host "Starting download from $($package.URL)"
|
||||||
|
@ -74,6 +78,7 @@ if (Test-Path -Path "$packagePath") {
|
||||||
Invoke-Command -ScriptBlock {
|
Invoke-Command -ScriptBlock {
|
||||||
& $7z -o"$workingDir" -y e "$packagePath"
|
& $7z -o"$workingDir" -y e "$packagePath"
|
||||||
& $7z -o"$workingDir" -y e "$payloadPath"
|
& $7z -o"$workingDir" -y e "$payloadPath"
|
||||||
|
if (-not (Test-Path -PathType Container $landingDir)) {mkdir $landingDir > $null}
|
||||||
& $7z -o"$landingDir" -y x "$dmgPath"
|
& $7z -o"$landingDir" -y x "$dmgPath"
|
||||||
# # If just downloading, put the extracted installers on the desktop
|
# # If just downloading, put the extracted installers on the desktop
|
||||||
# if ($Install) {
|
# if ($Install) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue