| <# | |
| Add the repository's local ffmpeg 'bin' folder to the PATH for the current PowerShell session. | |
| Usage: | |
| .\add_ffmpeg_path.ps1 | |
| This does not modify the system PATH permanently; it only updates PATH for the running session. | |
| #> | |
| try { | |
| $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition | |
| # repo root is one level up from scripts folder | |
| $repoRoot = Resolve-Path (Join-Path $scriptDir "..") | |
| $ffmpegBin = Join-Path $repoRoot "ffmpeg-8.0-essentials_build\bin" | |
| if (Test-Path $ffmpegBin) { | |
| # Prepend so local binary is preferred | |
| $env:PATH = "$ffmpegBin;$env:PATH" | |
| Write-Host "Added local ffmpeg bin to PATH: $ffmpegBin" | |
| exit 0 | |
| } else { | |
| Write-Error "ffmpeg bin not found at: $ffmpegBin" | |
| exit 1 | |
| } | |
| } catch { | |
| Write-Error "Failed to add ffmpeg to PATH: $_" | |
| exit 2 | |
| } | |