File tree 1 file changed +8
-5
lines changed 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -127,8 +127,7 @@ param(
127
127
[string ]$BuildEdition = " stable" ,
128
128
129
129
[Parameter ()]
130
- [switch ]
131
- $User ,
130
+ [switch ]$User ,
132
131
133
132
[Parameter ()]
134
133
[ValidateNotNull ()]
@@ -175,7 +174,7 @@ if (!($IsLinux -or $IsOSX)) {
175
174
break ;
176
175
}
177
176
}
178
- if (( $User -eq $true ) - and ( $BuildEdition -eq " Insider" ) ) {
177
+ if ($User -and $BuildEdition -eq " Insider" ) {
179
178
$codeCmdPath = " $env: LocalAppData \Programs\Microsoft VS Code Insiders\bin\code-insiders.cmd"
180
179
$appName = " Visual Studio Code - Insiders Edition ($ ( $Architecture ) - User)"
181
180
$fileUri = " https://vscode-update.azurewebsites.net/latest/$ ( $bitVersion ) -user/$ ( $BuildEdition ) "
@@ -188,8 +187,12 @@ if (!($IsLinux -or $IsOSX)) {
188
187
189
188
if (! (Test-Path $codeCmdPath )) {
190
189
Write-Host " `n Downloading latest $appName ..." - ForegroundColor Yellow
191
- Remove-Item - Force " $env: TEMP \vscode-$ ( $BuildEdition ) .exe" - ErrorAction SilentlyContinue
192
- Start-BitsTransfer $fileUri - Destination " $env: TEMP \vscode-$ ( $BuildEdition ) .exe"
190
+ Remove-Item - Force " $env: TEMP \vscode-$ ( $BuildEdition ) .exe" - ErrorAction SilentlyContinuev
191
+ $bitsDl = Start-BitsTransfer $fileUri - Destination " $env: TEMP \vscode-$ ( $BuildEdition ) .exe" - Asynchronous
192
+ do {
193
+ Write-Progress - Activity " Downloading: $AppName " - Status " $ ( [math ]::round($bitsDl.BytesTransferred / 1 mb )) mb / $ ( [math ]::round($bitsDl.BytesTotal / 1 mb )) mb" - PercentComplete ($ ($bitsDl.BytesTransferred ) / $ ($bitsDl.BytesTotal ) * 100 )
194
+ }
195
+ until ($bitsDl.JobState -eq " Transferred" )
193
196
194
197
Write-Host " `n Installing $appName ..." - ForegroundColor Yellow
195
198
Start-Process - Wait " $env: TEMP \vscode-$ ( $BuildEdition ) .exe" - ArgumentList / silent, / mergetasks= ! runcode
You can’t perform that action at this time.
0 commit comments