feat: EXE 图标支持 (bookworm.ico 16/32/48/256px + rcedit 注入)

This commit is contained in:
bookworm 2026-04-07 01:08:41 +08:00
parent ee8fa10fdc
commit a2a7ff1edb
2 changed files with 23 additions and 8 deletions

BIN
bookworm.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

View File

@ -65,14 +65,21 @@ if ($buildSetup) {
Write-Host " 输入: $inputPs1" -ForegroundColor Gray
Write-Host " 输出: $outputExe" -ForegroundColor Gray
Invoke-ps2exe `
-InputFile $inputPs1 `
-OutputFile $outputExe `
-Title "Bookworm Portable Setup" `
-Description "Bookworm Smart Assistant 安装向导" `
-Company "Bookworm" `
-Version "1.5.0.0" `
-NoConsole # 纯 GUI不弹黑色控制台窗口
$iconFile = Join-Path $ScriptDir "bookworm.ico"
$ps2exeArgs = @{
InputFile = $inputPs1
OutputFile = $outputExe
Title = "Bookworm Portable Setup"
Description = "Bookworm Smart Assistant 安装向导"
Company = "Bookworm"
Version = "1.5.0.0"
NoConsole = $true
}
if (Test-Path $iconFile) {
$ps2exeArgs.IconFile = $iconFile
Write-Host " 图标: $iconFile" -ForegroundColor Gray
}
Invoke-ps2exe @ps2exeArgs
if (Test-Path $outputExe) {
$sizeKB = [math]::Round((Get-Item $outputExe).Length / 1KB)
@ -126,6 +133,14 @@ if ($buildAdmin) {
if (Test-Path $outputExe) {
$sizeMB = [math]::Round((Get-Item $outputExe).Length / 1MB, 1)
Write-OK "gen-authcode.exe 打包完成 (${sizeMB} MB)"
# 注入图标 (rcedit)
$iconFile = Join-Path $ScriptDir "bookworm.ico"
$rcedit = "$env:APPDATA\npm\node_modules\rcedit\bin\rcedit-x64.exe"
if ((Test-Path $iconFile) -and (Test-Path $rcedit)) {
& $rcedit $outputExe --set-icon $iconFile | Out-Null
Write-OK "gen-authcode.exe 图标注入完成"
}
} else {
Write-Fail "gen-authcode.exe 打包失败"
exit 1