forked from kitagry/asyncomplete-tabnine.vim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.ps1
35 lines (28 loc) · 1002 Bytes
/
install.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
$web = New-Object Net.WebClient
$versionUrl = "https://update.tabnine.com/version"
$version = $web.DownloadString($versionUrl).replace("`n","")
$arch_raw = Get-CimInstance Win32_OperatingSystem | Select-Object 'OSArchitecture' | Format-Table -HideTableHeaders | Out-String
switch ( $arch_raw.Trim().Substring(0,2) ) {
"64" { $arch = "x86_64" }
"32" { $arch = "i686" }
}
$triple = ( $arch + "-pc-windows-gnu" )
$path = "$PSScriptRoot\binaries\$version\$triple"
$url = ( "https://update.tabnine.com/$version/$triple/TabNine.exe" )
if (!(Test-Path -Path "$path\TabNine.exe")) {
Write-Host "Downloading TabNine executable..."
New-Item -ItemType directory -Path $path
Try {
$web.DownloadFile(
$url,
$ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
"$path\TabNine.exe"
)
)
Write-Host "Successful!"
}
Catch {
Write-Host $($_.Exception.ToString())
}
}