mirror of
https://github.com/WT810787899/YuChuan.git
synced 2026-12-05 16:01:48 +00:00
- windows/CMakeLists.txt: BINARY_NAME rust_flutter_ui -> YuChuan (CMake 的 target 名不支持非 ASCII,写「雨传」会直接报 Cannot specify compile definitions for target 雨传 which is not built, 所以构建名用 ASCII,发布时由 package_release.ps1 改名为「雨传.exe」) - windows/runner/CMakeLists.txt: 加 /utf-8 —— main.cpp 是无 BOM 的 UTF-8, 不指定的话 MSVC 按系统代码页(GBK)读,中文字面量会变乱码 - windows/runner/main.cpp: 原生窗口标题 YuChuan -> 雨传 YuChuan - windows/runner/Runner.rc: 版本资源补齐/修正 FileDescription -> 雨传 YuChuan - 局域网聊天 / 传文件工具 ProductName/InternalName/OriginalFilename -> 雨传 LegalCopyright 去掉模板残留的 com.example - scripts: 同步 exe 名;新增 package_release.ps1(便携版 zip + 安卓包) 说明:图标是编译期嵌进二进制的,改图标必须重新构建(本机无 rcedit/ ResourceHacker 之类可直接改 exe 资源的工具)。
39 lines
1.7 KiB
PowerShell
39 lines
1.7 KiB
PowerShell
# 同机双实例联调(发现 + 聊天自测):第二个实例带 LANCHAT_INSTANCE=2(独立身份)
|
||
# 和 LANCHAT_CHAT_PORT=45997(TCP 端口不能复用,否则第二个实例监听失败)。
|
||
# A 端要连 B,需要手动直连 B 的 IP:45997 或让 A 通过发现结果拨号。
|
||
# 用法: .\scripts\run_two_instances.ps1 [-WaitSeconds 20]
|
||
param([int]$WaitSeconds = 20)
|
||
$ErrorActionPreference = 'Continue'
|
||
$root = Split-Path $PSScriptRoot -Parent
|
||
$exe = "$root\build\windows\x64\runner\Release\雨传.exe"
|
||
if (-not (Test-Path $exe)) { throw '先构建:.\scripts\build_windows.ps1' }
|
||
|
||
$temp = $env:TEMP
|
||
Get-Process rust_flutter_ui -ErrorAction SilentlyContinue | Stop-Process -Force
|
||
Start-Sleep -Seconds 1
|
||
|
||
$a = Start-Process $exe -PassThru
|
||
Start-Sleep -Seconds 3
|
||
$env:LANCHAT_INSTANCE = '2'
|
||
$env:LANCHAT_CHAT_PORT = '45997'
|
||
$b = Start-Process $exe -PassThru
|
||
Remove-Item Env:\LANCHAT_INSTANCE -ErrorAction SilentlyContinue
|
||
Remove-Item Env:\LANCHAT_CHAT_PORT -ErrorAction SilentlyContinue
|
||
Write-Host "实例 A pid=$($a.Id) / B pid=$($b.Id)(B:独立身份 + 聊天端口 45997)"
|
||
|
||
Start-Sleep -Seconds $WaitSeconds
|
||
foreach ($p in @($a, $b)) {
|
||
Write-Host "=== pid $($p.Id) 启动诊断 ==="
|
||
$diag = "$temp\lanchat_startup_diag_$($p.Id).txt"
|
||
if (Test-Path $diag) {
|
||
Get-Content $diag -Encoding UTF8 |
|
||
Select-String -Pattern 'discovery_self|discovery_devices|chat_ready|chat_port|chat_conversations|chat_error' |
|
||
Select-Object -Last 6 | ForEach-Object { $_.Line }
|
||
} else {
|
||
Write-Host '(无诊断文件)'
|
||
}
|
||
}
|
||
|
||
Stop-Process -Id $a.Id, $b.Id -Force -ErrorAction SilentlyContinue
|
||
Write-Host '已结束两个实例。'
|