rojo/install.ps1
Joe a1cba88b94 Enhance installation script for conditional build modes
- Updated the installation script to conditionally handle release builds by enabling debug information in the release profile.
- Added logic to copy the PDB file alongside the executable to the installation directory, improving debugging capabilities.
2026-01-24 04:41:05 -06:00

26 lines
891 B
PowerShell

#Requires -Version 5.1
param([string]$Mode = "release")
$InstallDir = "C:\Program Files\Rojo"
Set-Location $PSScriptRoot
if ($Mode -eq "release") {
cargo build --release --config "profile.release.debug=true"
} else {
cargo build "--$Mode"
}
$Rojo = ".\target\$Mode\rojo.exe"
& "$Rojo" build plugin.project.json --plugin Rojo.rbxm
if ($LASTEXITCODE -ne 0) { throw "Plugin build failed" }
gsudo Stop-Process -Name "rojo" -Force -ErrorAction SilentlyContinue
gsudo New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
gsudo Copy-Item "$Rojo" "$InstallDir\"
gsudo Copy-Item ".\target\$Mode\rojo.pdb" "$InstallDir\"
$MachinePath = [Environment]::GetEnvironmentVariable("Path", "Machine")
if ($MachinePath -notlike "*$InstallDir*") {
gsudo [Environment]::SetEnvironmentVariable "Path" "$MachinePath;$InstallDir" "Machine"
Write-Host "Added '$InstallDir' to system PATH"
}