Fix null argument issue

This commit is contained in:
Calyx Hikari 2025-06-29 14:39:34 +08:00
parent 427eb4abfa
commit 2ab3c169e9
4 changed files with 24 additions and 12 deletions

9
32
View file

@ -91,7 +91,7 @@ function Main {
foreach ($item in $downloads) { foreach ($item in $downloads) {
$outFile = Join-Path $tempDir $item.Name $outFile = Join-Path $tempDir $item.Name
Write-Host "Downloading $($item.Name)..." Write-Host "Downloading $($item.Name)..."
Start-Process -FilePath $aria2Exe -ArgumentList @( $argumentList = @(
"--dir=`"$($outFile | Split-Path)`"", "--dir=`"$($outFile | Split-Path)`"",
"--out=`"$(Split-Path -Leaf $outFile)`"", "--out=`"$(Split-Path -Leaf $outFile)`"",
"--allow-overwrite=true", "--allow-overwrite=true",
@ -99,9 +99,12 @@ function Main {
"--max-connection-per-server=8", "--max-connection-per-server=8",
"--split=8", "--split=8",
"--min-split-size=1M", "--min-split-size=1M",
"$regionalWorkaround",
"`"$($item.Url)`"" "`"$($item.Url)`""
) -NoNewWindow -Wait )
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
$argumentList += $regionalWorkaround
}
Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait
} }
# --- Install DirectX --- # --- Install DirectX ---

9
64
View file

@ -102,7 +102,7 @@ function Main {
foreach ($item in $downloads) { foreach ($item in $downloads) {
$outFile = Join-Path $tempDir $item.Name $outFile = Join-Path $tempDir $item.Name
Write-Host "Downloading $($item.Name)..." Write-Host "Downloading $($item.Name)..."
Start-Process -FilePath $aria2Exe -ArgumentList @( $argumentList = @(
"--dir=`"$($outFile | Split-Path)`"", "--dir=`"$($outFile | Split-Path)`"",
"--out=`"$(Split-Path -Leaf $outFile)`"", "--out=`"$(Split-Path -Leaf $outFile)`"",
"--allow-overwrite=true", "--allow-overwrite=true",
@ -110,9 +110,12 @@ function Main {
"--max-connection-per-server=8", "--max-connection-per-server=8",
"--split=8", "--split=8",
"--min-split-size=1M", "--min-split-size=1M",
"$regionalWorkaround",
"`"$($item.Url)`"" "`"$($item.Url)`""
) -NoNewWindow -Wait )
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
$argumentList += $regionalWorkaround
}
Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait
} }
# --- Install VC++ Redistributables --- # --- Install VC++ Redistributables ---

9
dx
View file

@ -88,7 +88,7 @@ function Main {
foreach ($item in $downloads) { foreach ($item in $downloads) {
$outFile = Join-Path $tempDir $item.Name $outFile = Join-Path $tempDir $item.Name
Write-Host "Downloading $($item.Name)..." Write-Host "Downloading $($item.Name)..."
Start-Process -FilePath $aria2Exe -ArgumentList @( $argumentList = @(
"--dir=`"$($outFile | Split-Path)`"", "--dir=`"$($outFile | Split-Path)`"",
"--out=`"$(Split-Path -Leaf $outFile)`"", "--out=`"$(Split-Path -Leaf $outFile)`"",
"--allow-overwrite=true", "--allow-overwrite=true",
@ -96,9 +96,12 @@ function Main {
"--max-connection-per-server=8", "--max-connection-per-server=8",
"--split=8", "--split=8",
"--min-split-size=1M", "--min-split-size=1M",
"$regionalWorkaround",
"`"$($item.Url)`"" "`"$($item.Url)`""
) -NoNewWindow -Wait )
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
$argumentList += $regionalWorkaround
}
Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait
} }
# --- Install DirectX --- # --- Install DirectX ---

View file

@ -107,7 +107,7 @@ function Main {
} }
$outFile = Join-Path $tempDir $item.Name $outFile = Join-Path $tempDir $item.Name
Write-Host "Downloading $($item.Name)..." Write-Host "Downloading $($item.Name)..."
Start-Process -FilePath $aria2Exe -ArgumentList @( $argumentList = @(
"--dir=`"$($outFile | Split-Path)`"", "--dir=`"$($outFile | Split-Path)`"",
"--out=`"$(Split-Path -Leaf $outFile)`"", "--out=`"$(Split-Path -Leaf $outFile)`"",
"--allow-overwrite=true", "--allow-overwrite=true",
@ -115,9 +115,12 @@ function Main {
"--max-connection-per-server=8", "--max-connection-per-server=8",
"--split=8", "--split=8",
"--min-split-size=1M", "--min-split-size=1M",
"$regionalWorkaround",
"`"$($item.Url)`"" "`"$($item.Url)`""
) -NoNewWindow -Wait )
if (![string]::IsNullOrEmpty($regionalWorkaround)) {
$argumentList += $regionalWorkaround
}
Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait
} }
# --- Install DirectX --- # --- Install DirectX ---