# Creates "Proxy God.lnk" on the current user's Desktop. Run after build.
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
$desk = [Environment]::GetFolderPath("Desktop")
$exeDesk = Join-Path $desk "ProxyChainManager.exe"
$exeDist = Join-Path $root "dist\ProxyChainManager.exe"
if (Test-Path $exeDesk) {
    $target = (Resolve-Path $exeDesk).Path
} elseif (Test-Path $exeDist) {
    $target = (Resolve-Path $exeDist).Path
} else {
    Write-Warning "ProxyChainManager.exe not found on Desktop or in dist\"
    exit 1
}
$W = New-Object -ComObject WScript.Shell
$lnk = Join-Path $desk "Proxy God.lnk"
$S = $W.CreateShortcut($lnk)
$S.TargetPath = $target
$S.WorkingDirectory = $root
$S.Description = "Proxy God - proxy chain manager"
$S.IconLocation = "$target,0"
$S.Save()
Write-Host "OK: $lnk -> $target"
