- Engines/ 配下へエンジン別に再編 (Common/Rgss/Tkool/Tyrano/Wolf/Unity/Nwjs) - ゲーム個別処理を Engines/<Engine>/Games/<GameName>/ へ分離し、共通処理から明示呼び出し - 外部ツールを Engines/<Engine>/Tools/ へ移動し、AppPathHelper 経由で解決 - 旧 Tools/ 直下参照と不要な参照ファイル/バックアップを削除 - エージェント規則 AGENTS.md を追加し、README から参照 - publish.ps1 を Engines/<Engine>/Tools/ の再帰配置に対応
68 lines
3.4 KiB
PowerShell
68 lines
3.4 KiB
PowerShell
# GameLauncher 単一ファイル発行スクリプト
|
|
# 公開先: Z:\自作ソフト\GameLauncher\
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$projectDir = $PSScriptRoot
|
|
$publishDir = "Z:\自作ソフト\GameLauncher"
|
|
|
|
Write-Host "=== GameLauncher 発行処理開始 (発行先: $publishDir) ===" -ForegroundColor Cyan
|
|
|
|
if (!(Test-Path $publishDir)) {
|
|
New-Item -ItemType Directory -Path $publishDir -Force | Out-Null
|
|
}
|
|
|
|
Write-Host "プロジェクトのビルドおよび単一ファイル発行中..." -ForegroundColor Yellow
|
|
|
|
dotnet publish "$projectDir\GameLauncher.csproj" -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -o "$publishDir"
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
# プラグインおよび設定ファイルの配置
|
|
if (Test-Path "$projectDir\plugins") {
|
|
if (!(Test-Path "$publishDir\plugins")) {
|
|
New-Item -ItemType Directory -Path "$publishDir\plugins" -Force | Out-Null
|
|
}
|
|
Copy-Item -Path "$projectDir\plugins\*" -Destination "$publishDir\plugins" -Recurse -Force
|
|
}
|
|
if (Test-Path "$projectDir\Config.tjs") {
|
|
Copy-Item -Path "$projectDir\Config.tjs" -Destination "$publishDir\Config.tjs" -Force
|
|
}
|
|
# エンジン別の外部ツール(Engines\<Engine>\Tools 配下)を配置する。
|
|
# 各エンジンは自身のツールフォルダのみを参照するため、エンジン間で干渉しない。
|
|
$enginesRoot = Join-Path $projectDir "Engines"
|
|
if (Test-Path $enginesRoot) {
|
|
foreach ($engineDir in Get-ChildItem -Path $enginesRoot -Directory) {
|
|
$srcTools = Join-Path $engineDir.FullName "Tools"
|
|
if (Test-Path $srcTools) {
|
|
$dstTools = Join-Path (Join-Path $publishDir "Engines") (Join-Path $engineDir.Name "Tools")
|
|
if (!(Test-Path $dstTools)) {
|
|
New-Item -ItemType Directory -Path $dstTools -Force | Out-Null
|
|
}
|
|
robocopy $srcTools $dstTools /E /NP /R:1 /W:1 | Out-Null
|
|
}
|
|
}
|
|
}
|
|
|
|
# nw.js boxed 用の外部アンパッカーを事前配置(未配置なら実行時にも自動取得を試行)
|
|
# 7zr.exe は依存DLL不要の単体実行版。取得失敗時はスキップし、実行時に NwjsUnpackerToolProvider が再取得を試みる。
|
|
$nwjsToolsDir = Join-Path (Join-Path $publishDir "Engines") "Nwjs\Tools"
|
|
$unpackerPresent = $false
|
|
foreach ($cand in @("$nwjsToolsDir\7zr.exe", "$nwjsToolsDir\7z.exe")) {
|
|
if (Test-Path $cand) { $unpackerPresent = $true; break }
|
|
}
|
|
if (!$unpackerPresent) {
|
|
if (!(Test-Path $nwjsToolsDir)) {
|
|
New-Item -ItemType Directory -Path $nwjsToolsDir -Force | Out-Null
|
|
}
|
|
try {
|
|
Write-Host "nw.js boxed 用アンパッカー(7zr.exe)を取得中..." -ForegroundColor Yellow
|
|
Invoke-WebRequest -Uri "https://www.7-zip.org/a/7zr.exe" -OutFile "$nwjsToolsDir\7zr.exe" -UseBasicParsing -TimeoutSec 120
|
|
Write-Host "アンパッカーを配置しました: $nwjsToolsDir\7zr.exe" -ForegroundColor Green
|
|
} catch {
|
|
Write-Host "アンパッカーの取得に失敗しました(実行時に再取得を試行します): $($_.Exception.Message)" -ForegroundColor Yellow
|
|
}
|
|
}
|
|
Write-Host "発行成功: $publishDir\GameLauncher.exe" -ForegroundColor Green
|
|
} else {
|
|
Write-Host "発行失敗 (終了コード: $LASTEXITCODE)" -ForegroundColor Red
|
|
} |