build-portable.ps1 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # Portable packager for Steam求购 custom edition (dakehu).
  2. # Output: SteamQG_Portable.zip — does NOT overwrite SteamSH_Portable.zip / steamSH_V*.exe
  3. param(
  4. [string]$SourceExe = "SteamQG.exe",
  5. [string]$OutputFile = "SteamQG_Portable.exe"
  6. )
  7. $ErrorActionPreference = "Stop"
  8. [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
  9. Write-Host "========================================" -ForegroundColor Cyan
  10. Write-Host "SteamQG (Steam求购) portable packager" -ForegroundColor Cyan
  11. Write-Host "========================================" -ForegroundColor Cyan
  12. Write-Host "`n[1/3] Checking source..." -ForegroundColor Yellow
  13. if (-not (Test-Path $SourceExe)) {
  14. Write-Host "ERROR: source not found: $SourceExe" -ForegroundColor Red
  15. Write-Host "Run tauri build then build-windows.ps1 first." -ForegroundColor Yellow
  16. exit 1
  17. }
  18. Write-Host " OK: $SourceExe" -ForegroundColor Green
  19. Write-Host "`n[2/3] Preparing package folder..." -ForegroundColor Yellow
  20. $tempDir = Join-Path $env:TEMP "SteamQG_Portable_$(Get-Date -Format 'yyyyMMdd_HHmmss')"
  21. New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
  22. Copy-Item $SourceExe (Join-Path $tempDir "SteamQG.exe") -Force
  23. $startBat = @"
  24. @echo off
  25. chcp 65001 >nul
  26. echo Starting SteamQG...
  27. cd /d "%~dp0"
  28. start "" "SteamQG.exe"
  29. "@
  30. $startBat | Out-File (Join-Path $tempDir "start.bat") -Encoding UTF8
  31. $readme = @"
  32. SteamQG Portable (Steam求购 custom edition)
  33. ==========================================
  34. 1. Double-click start.bat or SteamQG.exe
  35. 2. Standalone, no install required
  36. 3. Independent from old steamSH / Youdangdang builds
  37. "@
  38. $readme | Out-File (Join-Path $tempDir "README.txt") -Encoding UTF8
  39. Write-Host " OK" -ForegroundColor Green
  40. Write-Host "`n[3/3] Creating zip..." -ForegroundColor Yellow
  41. $zipFile = "SteamQG_Portable.zip"
  42. if (Test-Path $zipFile) { Remove-Item $zipFile -Force }
  43. Compress-Archive -Path (Join-Path $tempDir "*") -DestinationPath $zipFile -Force
  44. Write-Host " OK: $zipFile ($([math]::Round((Get-Item $zipFile).Length / 1MB, 2)) MB)" -ForegroundColor Green
  45. Remove-Item $tempDir -Recurse -Force -ErrorAction SilentlyContinue
  46. Write-Host "`nDone. Old SteamSH_Portable.zip / steamSH_V*.exe untouched." -ForegroundColor Yellow