33 lines
1.3 KiB
PowerShell
33 lines
1.3 KiB
PowerShell
param(
|
|
[Parameter(Mandatory=$true)][string]$Version, # v3 or v4
|
|
[Parameter(Mandatory=$true)][string]$BinPath, # path to target\release\avidaed_onefile.exe
|
|
[Parameter(Mandatory=$true)][string]$WV2Fixed # path to WebView2 Fixed Runtime folder
|
|
)
|
|
$Work = Join-Path $PSScriptRoot "payload_$Version"
|
|
Remove-Item $Work -Recurse -Force -ErrorAction SilentlyContinue
|
|
New-Item -ItemType Directory -Force -Path $Work | Out-Null
|
|
Copy-Item $BinPath -Destination (Join-Path $Work "avidaed_onefile.exe")
|
|
Copy-Item $WV2Fixed -Destination (Join-Path $Work "WebView2Fixed") -Recurse
|
|
|
|
# launcher
|
|
$runbat = @"
|
|
@echo off
|
|
setlocal
|
|
set WEBVIEW2_BROWSER_EXECUTABLE_FOLDER=%~dp0WebView2Fixed
|
|
start "" "%~dp0avidaed_onefile.exe"
|
|
"@
|
|
$runbat | Out-File -Encoding ASCII (Join-Path $Work "run.bat")
|
|
|
|
# create 7z archive
|
|
$SevenZip = "C:\Program Files\7-Zip\7z.exe"
|
|
& $SevenZip a -t7z (Join-Path $PSScriptRoot "payload_$Version.7z") "$Work\*"
|
|
|
|
# concatenate SFX + config + archive -> one EXE
|
|
$Sfx = Join-Path $PSScriptRoot "7z.sfx"
|
|
$Cfg = Join-Path $PSScriptRoot "config.txt"
|
|
$Out = Join-Path $PSScriptRoot ("Avida-ED-$Version-Windows.exe")
|
|
Get-Content $Sfx -Encoding Byte, $Cfg -Encoding Byte, (Join-Path $PSScriptRoot "payload_$Version.7z") -Encoding Byte |
|
|
Set-Content $Out -Encoding Byte
|
|
Write-Host "Wrote $Out"
|
|
|