Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 37 additions & 10 deletions install.ps1
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,46 @@
#!/usr/bin/env pwsh

$version = '0.1.145'
$name = 'languageclient'
$url = "https://github.com/autozimu/LanguageClient-neovim/releases/download/$version/$name-$version-"

if ($ENV:PROCESSOR_ARCHITECTURE -eq 'AMD64') {
$url += 'x86_64'
} else {
$url += 'i686'
}
$path = "$PSScriptRoot\bin\$name"

$url += '-pc-windows-gnu.exe'
switch ($true) {
$IsMacOS {
# MacOS is always x86_64
$url += 'x86_64-apple-darwin'
}
$IsLinux {
# Detecting architecture is more involved on Linux
$arch = uname -sm
$url += switch ($arch) {
'Linux x86_64' { 'x86_64' }
'Linux i686' { 'i686' }
'Linux aarch64' { 'aarch64' }
Default { throw 'architecture not supported' }
}
$url += '-unknown-linux-musl'
}
Default {
# Windows
$url += if ([Environment]::Is64BitOperatingSystem) { 'x86_64' } else { 'i686' }
$url += '-pc-windows-gnu.exe'

# We need to tack on the .exe to the end of the download path
$path += '.exe'
}
}

$path = "$PSScriptRoot\bin\$name.exe"
if (Test-Path $path) {
Remove-Item -Force $path
if (Test-Path -LiteralPath $path) {
Remove-Item -Force -LiteralPath $path
}

echo "Downloading $url ..."
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

if (!$IsCoreCLR) {
# We only need to do this for Windows PowerShell
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
}

Invoke-WebRequest -Uri $url -OutFile $path