1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-23 22:40:08 +00:00

fix(windows): align source channel and prerelease binaries

Refs #538
This commit is contained in:
Tw93
2026-03-06 08:34:10 +08:00
parent 7c9b420a22
commit d0f627892d
17 changed files with 732 additions and 453 deletions

View File

@@ -12,7 +12,8 @@ $ErrorActionPreference = "Stop"
# Script location
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$windowsDir = Split-Path -Parent $scriptDir
$binPath = Join-Path $windowsDir "bin\status.exe"
$defaultBinPath = Join-Path $windowsDir "bin\status.exe"
. (Join-Path $windowsDir "lib\core\tui_binaries.ps1")
# Help
function Show-StatusHelp {
@@ -45,29 +46,11 @@ if ($ShowHelp) {
return
}
# Check if binary exists
if (-not (Test-Path $binPath)) {
Write-Host "Building status tool..." -ForegroundColor Cyan
$cmdDir = Join-Path $windowsDir "cmd\status"
$binDir = Join-Path $windowsDir "bin"
if (-not (Test-Path $binDir)) {
New-Item -ItemType Directory -Path $binDir -Force | Out-Null
}
Push-Location $windowsDir
try {
$result = & go build -o "$binPath" "./cmd/status/" 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host "Failed to build status tool: $result" -ForegroundColor Red
Pop-Location
return
}
}
finally {
Pop-Location
}
$binPath = Ensure-TuiBinary -Name "status" -WindowsDir $windowsDir -DestinationPath $defaultBinPath -SourcePath "./cmd/status/"
if (-not $binPath) {
Write-Host "Status binary not found, no prerelease asset was available, and Go 1.24+ is not installed." -ForegroundColor Red
Write-Host "Install Go or wait for a Windows prerelease asset that includes status.exe." -ForegroundColor Yellow
exit 1
}
# Run the binary