-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.ps1
31 lines (23 loc) · 1.2 KB
/
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
$folder = Join-Path $env:APPDATA 'Scooter Software\SQLite Plugin'
if(-not(Test-Path $folder))
{
New-Item -Path $folder -ItemType directory
}
Get-ChildItem -Path $folder | Remove-Item -Recurse -Force -confirm:$false
$tempFile = "{0}.zip" -f [System.Guid]::NewGuid()
$releasesWebPage = Invoke-WebRequest https://github.com/dhcgn/BeyondCompareSQLitePlugin/releases
$uri = 'https://github.com/'+ ($releasesWebPage.Links | Where-Object{$_.href -like '*download*'} | Select-Object href -First 1 | ForEach-Object{$_.href})
Invoke-WebRequest -Uri $uri -OutFile (Join-Path $folder $tempFile)
Expand-Archive -Path (Join-Path $folder $tempFile) -DestinationPath $folder
Remove-Item -Path (Join-Path $folder $tempFile)
$bcFileFormat = Join-Path $env:APPDATA 'Scooter Software\Beyond Compare 4\BCFileFormats.xml'
if (-not (Test-Path $bcFileFormat))
{
Start-Process -FilePath 'https://github.com/dhcgn/BeyondCompareSQLitePlugin/wiki/Install'
Exit
}
$pluginIsConfigured = Select-String -Path $bcFileFormat -Pattern (Get-ChildItem -Path $folder -Filter *.exe | ForEach-Object{$_.Name}) -Quiet
if($pluginIsConfigured -eq $false)
{
Start-Process -FilePath 'https://github.com/dhcgn/BeyondCompareSQLitePlugin/wiki/Install'
}