Add Windows launcher scripts and include them in publish output
LaunchOpenTheBox.cmd + Launch.ps1 set UTF-8 encoding, window title, and error feedback. Fallback chain: Windows Terminal → pwsh → powershell → cmd. Scripts are auto-copied to publish root via the csproj. Also adds builds/ to .gitignore and updates README distribute section.
This commit is contained in:
parent
4d8d5224e1
commit
1b6b635335
5 changed files with 56 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -42,3 +42,5 @@ Thumbs.db
|
||||||
|
|
||||||
## Claude
|
## Claude
|
||||||
.claude/
|
.claude/
|
||||||
|
|
||||||
|
builds
|
||||||
|
|
@ -73,7 +73,8 @@ dotnet run --project src/OpenTheBox
|
||||||
## Distribute
|
## Distribute
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
dotnet publish -c Release -r win-x64
|
dotnet publish src/OpenTheBox -c Release -r win-x64 -o "builds/$(Get-Date -Format yyyyMMdd_HHmmss)_win"
|
||||||
|
dotnet publish src/OpenTheBox -c Release -r linux-x64-o "builds/$(Get-Date -Format yyyyMMdd_HHmmss)_linux"
|
||||||
```
|
```
|
||||||
|
|
||||||
This produces a self-contained single-file executable in `publish/<runtime>/`. The target machine does **not** need .NET installed. Distribute the entire folder (exe + `content/`).
|
This produces a self-contained single-file executable in `publish/<runtime>/`. The target machine does **not** need .NET installed. Distribute the entire folder (exe + `content/`).
|
||||||
|
|
|
||||||
|
|
@ -42,4 +42,10 @@
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Windows launcher scripts — copied to publish root next to the exe -->
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="launcher\LaunchOpenTheBox.cmd" CopyToPublishDirectory="PreserveNewest" Link="LaunchOpenTheBox.cmd" />
|
||||||
|
<None Include="launcher\Launch.ps1" CopyToPublishDirectory="PreserveNewest" Link="Launch.ps1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
17
src/OpenTheBox/launcher/Launch.ps1
Normal file
17
src/OpenTheBox/launcher/Launch.ps1
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
$Host.UI.RawUI.WindowTitle = 'Open The Box'
|
||||||
|
[Console]::OutputEncoding = [Text.Encoding]::UTF8
|
||||||
|
[Console]::InputEncoding = [Text.Encoding]::UTF8
|
||||||
|
Set-Location $PSScriptRoot
|
||||||
|
|
||||||
|
$exe = Join-Path $PSScriptRoot 'OpenTheBox.exe'
|
||||||
|
if (-not (Test-Path $exe)) {
|
||||||
|
Write-Host "ERROR: OpenTheBox.exe not found in $PSScriptRoot" -ForegroundColor Red
|
||||||
|
Read-Host 'Press Enter to exit'
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
& $exe @args
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host "`nGame exited with code $LASTEXITCODE" -ForegroundColor Yellow
|
||||||
|
Read-Host 'Press Enter to exit'
|
||||||
|
}
|
||||||
29
src/OpenTheBox/launcher/LaunchOpenTheBox.cmd
Normal file
29
src/OpenTheBox/launcher/LaunchOpenTheBox.cmd
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
@echo off
|
||||||
|
REM Launcher for Open The Box — opens in Windows Terminal, PowerShell, or cmd with UTF-8.
|
||||||
|
REM Point Steam's launch target to this file.
|
||||||
|
|
||||||
|
title Open The Box
|
||||||
|
set "LAUNCH_PS1=%~dp0Launch.ps1"
|
||||||
|
|
||||||
|
where wt >nul 2>nul
|
||||||
|
if %ERRORLEVEL% equ 0 (
|
||||||
|
wt new-tab --title "Open The Box" -- powershell -NoProfile -ExecutionPolicy Bypass -File "%LAUNCH_PS1%" %*
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
where pwsh >nul 2>nul
|
||||||
|
if %ERRORLEVEL% equ 0 (
|
||||||
|
pwsh -NoProfile -ExecutionPolicy Bypass -File "%LAUNCH_PS1%" %*
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
where powershell >nul 2>nul
|
||||||
|
if %ERRORLEVEL% equ 0 (
|
||||||
|
powershell -NoProfile -ExecutionPolicy Bypass -File "%LAUNCH_PS1%" %*
|
||||||
|
goto :eof
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Fallback: cmd with UTF-8 codepage
|
||||||
|
chcp 65001 >nul 2>nul
|
||||||
|
"%~dp0OpenTheBox.exe" %*
|
||||||
|
if %ERRORLEVEL% neq 0 pause
|
||||||
Loading…
Add table
Reference in a new issue