File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -266,7 +266,7 @@ function Get-UnityEditor {
266
266
([OperatingSystem ]::Windows) {
267
267
$editor = Join-Path " $p " ' Editor\Unity.exe'
268
268
269
- if (Test-Path $editor ) {
269
+ if (Test-Path $editor ) {
270
270
Write-Output (Resolve-Path $editor ).Path
271
271
}
272
272
}
@@ -783,16 +783,12 @@ function Request-UnitySetupInstaller {
783
783
}
784
784
785
785
$elapsedTime = (Get-Date ) - $data.startTime
786
-
787
786
$progress = [int ](($data.receivedBytes / [double ]$data.totalBytes ) * 100 )
787
+ $secondsRemaining = -1 # -1 for Write-Progress prevents seconds remaining from showing.
788
788
789
- $averageSpeed = $data.receivedBytes / $elapsedTime.TotalSeconds
790
- $secondsRemaining = ($data.totalBytes - $data.receivedBytes ) / $averageSpeed
791
-
792
- if ([double ]::IsInfinity($secondsRemaining )) {
793
- $averageSpeed = 0
794
- # -1 for Write-Progress prevents seconds remaining from showing.
795
- $secondsRemaining = -1
789
+ if ($data.receivedBytes -gt 0 -and $elapsedTime.TotalSeconds -gt 0 ) {
790
+ $averageSpeed = $data.receivedBytes / $elapsedTime.TotalSeconds
791
+ $secondsRemaining = ($data.totalBytes - $data.receivedBytes ) / $averageSpeed
796
792
}
797
793
798
794
$downloadSpeed = Format-BitsPerSecond - Bytes $data.receivedBytes - Seconds $elapsedTime.TotalSeconds
You can’t perform that action at this time.
0 commit comments