fix IHTMLDocument2_write not exist (#36)

This commit is contained in:
木杉 2019-01-26 18:50:53 +08:00 committed by Ryan Dahl
parent e8a3ed1159
commit 36289b3be7

View file

@ -51,7 +51,11 @@ if (!$Version) {
if ($PSVersionTable.PSVersion.Major -lt 6) {
$Response = Invoke-WebRequest 'https://github.com/denoland/deno/releases'
$HTMLFile = New-Object -Com HTMLFile
$HTMLFile.IHTMLDocument2_write($Response.Content)
if ($HTMLFile.IHTMLDocument2_write) {
$HTMLFile.IHTMLDocument2_write($Response.Content)
} else {
$HTMLFile.write([System.Text.Encoding]::Unicode.GetBytes($Response.Content))
}
$DenoUri = $HTMLFile.getElementsByTagName('a') |
Where-Object { $_.href -like "about:/denoland/deno/releases/download/*/deno_${OS}_x64.$Zip" } |
ForEach-Object { $_.href -replace 'about:', 'https://github.com' } |