85 lines
3.6 KiB
PowerShell
85 lines
3.6 KiB
PowerShell
|
|
<#
|
||
|
|
.SYNOPSIS
|
||
|
|
Build Codename 206 and install the VST3 (and CLAP) into the system plugin folders.
|
||
|
|
|
||
|
|
.DESCRIPTION
|
||
|
|
FL Studio scans `C:\Program Files\Common Files\VST3` by default and ignores
|
||
|
|
directory junctions, so deployment must place a REAL bundle copy there. That
|
||
|
|
folder needs admin, so the copy step self-elevates (one UAC prompt).
|
||
|
|
|
||
|
|
After deploying, in FL Studio: Options -> Manage plugins ->
|
||
|
|
tick "Rescan previously failed plugins" -> "Find installed plugins".
|
||
|
|
|
||
|
|
.PARAMETER SkipBuild
|
||
|
|
Install the existing target\bundled output without rebuilding.
|
||
|
|
|
||
|
|
.PARAMETER User
|
||
|
|
Install to the per-user folder %LOCALAPPDATA%\Programs\Common\VST3 instead of
|
||
|
|
the global one. No admin required; add that path in FL's plugin search paths.
|
||
|
|
|
||
|
|
.EXAMPLE
|
||
|
|
.\deploy.ps1 # build + install to global VST3/CLAP (UAC prompt)
|
||
|
|
.\deploy.ps1 -SkipBuild # reinstall last build
|
||
|
|
.\deploy.ps1 -User # no-admin install for a fast dev loop
|
||
|
|
#>
|
||
|
|
param(
|
||
|
|
[switch]$SkipBuild,
|
||
|
|
[switch]$User,
|
||
|
|
[string]$Package = "codename_206"
|
||
|
|
)
|
||
|
|
|
||
|
|
$ErrorActionPreference = "Stop"
|
||
|
|
$root = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||
|
|
|
||
|
|
# rustup installs cargo here; make sure it's reachable even in a fresh shell.
|
||
|
|
$cargoBin = Join-Path $env:USERPROFILE ".cargo\bin"
|
||
|
|
if (Test-Path $cargoBin) { $env:Path = "$cargoBin;$env:Path" }
|
||
|
|
|
||
|
|
if (-not $SkipBuild) {
|
||
|
|
Write-Host "Building $Package (release)..." -ForegroundColor Cyan
|
||
|
|
Push-Location $root
|
||
|
|
try { cargo xtask bundle $Package --release } finally { Pop-Location }
|
||
|
|
if ($LASTEXITCODE -ne 0) { throw "cargo xtask bundle failed (exit $LASTEXITCODE)" }
|
||
|
|
}
|
||
|
|
|
||
|
|
$vst3Name = "Codename 206.vst3"
|
||
|
|
$clapName = "Codename 206.clap"
|
||
|
|
$bundled = Join-Path $root "target\bundled"
|
||
|
|
$vst3Src = Join-Path $bundled $vst3Name
|
||
|
|
$clapSrc = Join-Path $bundled $clapName
|
||
|
|
if (-not (Test-Path $vst3Src)) { throw "Bundle not found: $vst3Src (build first)" }
|
||
|
|
|
||
|
|
if ($User) {
|
||
|
|
$vst3Dst = Join-Path $env:LOCALAPPDATA "Programs\Common\VST3"
|
||
|
|
$clapDst = Join-Path $env:LOCALAPPDATA "Programs\Common\CLAP"
|
||
|
|
New-Item -ItemType Directory -Force -Path $vst3Dst, $clapDst | Out-Null
|
||
|
|
Write-Host "Installing (per-user, no admin)..." -ForegroundColor Cyan
|
||
|
|
Remove-Item (Join-Path $vst3Dst $vst3Name) -Recurse -Force -ErrorAction SilentlyContinue
|
||
|
|
Copy-Item $vst3Src -Destination $vst3Dst -Recurse -Force
|
||
|
|
if (Test-Path $clapSrc) { Copy-Item $clapSrc -Destination $clapDst -Force }
|
||
|
|
Write-Host "Installed to $vst3Dst" -ForegroundColor Green
|
||
|
|
Write-Host "Add that folder to FL's plugin search paths if you haven't." -ForegroundColor Yellow
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
$vst3Dst = Join-Path $env:CommonProgramFiles "VST3"
|
||
|
|
$clapDst = Join-Path $env:CommonProgramFiles "CLAP"
|
||
|
|
Write-Host "Installing to $vst3Dst (requires admin - accept the UAC prompt)..." -ForegroundColor Cyan
|
||
|
|
$cmd = @"
|
||
|
|
New-Item -ItemType Directory -Force -Path '$clapDst' | Out-Null
|
||
|
|
Remove-Item -LiteralPath '$vst3Dst\$vst3Name' -Recurse -Force -ErrorAction SilentlyContinue
|
||
|
|
Copy-Item -LiteralPath '$vst3Src' -Destination '$vst3Dst' -Recurse -Force
|
||
|
|
if (Test-Path -LiteralPath '$clapSrc') { Copy-Item -LiteralPath '$clapSrc' -Destination '$clapDst' -Force }
|
||
|
|
"@
|
||
|
|
$enc = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($cmd))
|
||
|
|
Start-Process powershell -Verb RunAs -Wait -ArgumentList '-NoProfile','-EncodedCommand',$enc
|
||
|
|
}
|
||
|
|
|
||
|
|
$check = Join-Path $vst3Dst "$vst3Name\Contents\x86_64-win\$vst3Name"
|
||
|
|
if (Test-Path $check) {
|
||
|
|
Write-Host "VST3 installed OK -> $check" -ForegroundColor Green
|
||
|
|
Write-Host "In FL Studio: Manage plugins -> 'Rescan previously failed plugins' -> Find installed plugins." -ForegroundColor Yellow
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
throw "Install verification failed: $check not found"
|
||
|
|
}
|