fix(crash): 修复双击闪退——路径基于可执行文件目录解析、崩溃兜底日志、资源入 bin 与安装包
This commit is contained in:
@@ -37,7 +37,13 @@ try {
|
||||
New-Item -ItemType Directory -Force -Path bin | Out-Null
|
||||
go build -tags $tags -trimpath -ldflags "-s -w" -o bin/mc-client.exe ./cmd/client
|
||||
go build -trimpath -ldflags "-s -w" -o bin/mc-server.exe ./cmd/server
|
||||
|
||||
# 资源入 bin/(可执行文件目录解析:双击/快捷方式运行无需依赖工作目录)
|
||||
Copy-Item (Join-Path $root "config") (Join-Path $root "bin") -Recurse -Force
|
||||
Copy-Item (Join-Path $root "assets") (Join-Path $root "bin") -Recurse -Force
|
||||
Copy-Item (Join-Path $root "mods") (Join-Path $root "bin") -Recurse -Force
|
||||
Copy-Item (Join-Path $root "resourcepacks") (Join-Path $root "bin") -Recurse -Force
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
Write-Host "== 构建完成:bin/mc-client.exe bin/mc-server.exe =="
|
||||
Write-Host "== 构建完成:bin/mc-client.exe bin/mc-server.exe(含资源) =="
|
||||
|
||||
@@ -22,6 +22,8 @@ Copy-Item (Join-Path $root "config\client.yaml") (Join-Path $stage "config")
|
||||
Copy-Item (Join-Path $root "config\server.yaml") (Join-Path $stage "config")
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $stage "mods") | Out-Null
|
||||
Copy-Item (Join-Path $root "mods\README.md") (Join-Path $stage "mods")
|
||||
# 游戏数据(方块/物品/配方注册表)
|
||||
Copy-Item (Join-Path $root "assets") (Join-Path $stage "assets") -Recurse
|
||||
# 默认素材包
|
||||
Copy-Item (Join-Path $root "resourcepacks") (Join-Path $stage "resourcepacks") -Recurse
|
||||
# 安装脚本(GBK 编码保证 cmd 中文显示)
|
||||
|
||||
Reference in New Issue
Block a user