-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.ps1
More file actions
39 lines (29 loc) · 1.22 KB
/
build.ps1
File metadata and controls
39 lines (29 loc) · 1.22 KB
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
36
37
38
39
# Windows build script for switcher
param(
[switch]$Install
)
Write-Host "Building switcher for Windows..." -ForegroundColor Green
# Build the executable
go build -o switcher.exe .
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed!" -ForegroundColor Red
exit 1
}
Write-Host "Build successful!" -ForegroundColor Green
if ($Install) {
Write-Host "Installing switcher..." -ForegroundColor Green
# Create installation directory
$installPath = "$env:LOCALAPPDATA\Programs\switcher"
New-Item -ItemType Directory -Force -Path $installPath | Out-Null
# Copy executable
Copy-Item -Path "switcher.exe" -Destination $installPath -Force
# Add to PATH if not already present
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($userPath -notlike "*$installPath*") {
[Environment]::SetEnvironmentVariable("Path", "$userPath;$installPath", "User")
Write-Host "Added to PATH: $installPath" -ForegroundColor Green
Write-Host "Please restart your terminal for PATH changes to take effect." -ForegroundColor Yellow
}
Write-Host "Installation complete!" -ForegroundColor Green
Write-Host "Installed to: $installPath\switcher.exe" -ForegroundColor Cyan
}