64 lines
2.6 KiB
PowerShell
64 lines
2.6 KiB
PowerShell
# RLogg Installation Script for Windows
|
|
# Run with: powershell -ExecutionPolicy Bypass -File install.ps1
|
|
|
|
param(
|
|
[string]$InstallPath = "$env:LOCALAPPDATA\Programs\RLogg"
|
|
)
|
|
|
|
Write-Host "Installing RLogg Log Viewer..." -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Determine the directory where this script is located
|
|
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$BinaryPath = Join-Path (Split-Path (Split-Path $ScriptDir -Parent) -Parent) "target\release\rlogg.exe"
|
|
|
|
# Check if rlogg.exe exists
|
|
if (-not (Test-Path $BinaryPath)) {
|
|
Write-Host "Error: rlogg.exe not found at $BinaryPath" -ForegroundColor Red
|
|
Write-Host "Please build the project first with: cargo build --release" -ForegroundColor Yellow
|
|
exit 1
|
|
}
|
|
|
|
# Create directory
|
|
Write-Host "Installing binary to $InstallPath..." -ForegroundColor Green
|
|
New-Item -ItemType Directory -Force -Path $InstallPath | Out-Null
|
|
|
|
# Copy binary
|
|
Copy-Item $BinaryPath $InstallPath\
|
|
|
|
# Create registry entries for .log file association
|
|
Write-Host "Configuring file associations..." -ForegroundColor Green
|
|
|
|
$regPath = "HKCU:\Software\Classes\.log"
|
|
New-Item -Path $regPath -Force | Out-Null
|
|
Set-ItemProperty -Path $regPath -Name "(default)" -Value "RLogg.LogFile"
|
|
|
|
$regPath = "HKCU:\Software\Classes\RLogg.LogFile"
|
|
New-Item -Path $regPath -Force | Out-Null
|
|
Set-ItemProperty -Path $regPath -Name "(default)" -Value "Log File"
|
|
|
|
$regPath = "HKCU:\Software\Classes\RLogg.LogFile\DefaultIcon"
|
|
New-Item -Path $regPath -Force | Out-Null
|
|
Set-ItemProperty -Path $regPath -Name "(default)" -Value "`"$InstallPath\rlogg.exe`",0"
|
|
|
|
$regPath = "HKCU:\Software\Classes\RLogg.LogFile\shell\open\command"
|
|
New-Item -Path $regPath -Force | Out-Null
|
|
Set-ItemProperty -Path $regPath -Name "(default)" -Value "`"$InstallPath\rlogg.exe`" `"%1`""
|
|
|
|
$regPath = "HKCU:\Software\Classes\RLogg.LogFile\shell\open"
|
|
New-Item -Path $regPath -Force | Out-Null
|
|
Set-ItemProperty -Path $regPath -Name "(default)" -Value "Open with RLogg"
|
|
|
|
Write-Host ""
|
|
Write-Host "Installation complete!" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "RLogg is installed at: $InstallPath\rlogg.exe" -ForegroundColor Cyan
|
|
Write-Host "File associations have been configured for .log files." -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "You can now double-click .log files to open them in RLogg." -ForegroundColor Yellow
|
|
Write-Host ""
|
|
Write-Host "To uninstall, run:" -ForegroundColor Yellow
|
|
Write-Host " Remove-Item -Recurse `"$InstallPath`"" -ForegroundColor Gray
|
|
Write-Host " Remove-Item -Recurse HKCU:\Software\Classes\.log" -ForegroundColor Gray
|
|
Write-Host " Remove-Item -Recurse HKCU:\Software\Classes\RLogg.LogFile" -ForegroundColor Gray
|