build: 用 rcedit 给 Scoreboard Console.exe 嵌入图标与版本信息

This commit is contained in:
AskaEth committed 2026-09-09 20:19:02 +08:00
1 parent 74e48bf5bc
commit ad3770cfc9
2 files changed
+36

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

+36
View File
@@ -67,6 +67,8 @@ copy /y "config.yaml" "%CONSOLE_OUT%\config.yaml" >nul || exit /b 1
REM app icon: the console loads it from the exe directory for tray / window icon
copy /y "console\scoreboard.png" "%CONSOLE_OUT%\scoreboard.png" >nul || exit /b 1
call :apply_icon
echo.
echo === 构建完成 ===
echo dist\scoreboard.exe 服务端
@@ -90,3 +92,37 @@ if not exist "%CONSOLE_OUT%\Scoreboard Console.exe" (
exit /b 1
)
exit /b 0
REM ---- stamp the app icon / version info into the exe --------------------------
REM electron-builder 的 "win.icon" 内部也是调 rcedit 改 PE 资源;rcedit 打包在
REM winCodeSign 里(GitHub 下载不通),这里从国内镜像取,用本机 7z 解出。
:apply_icon
set "RCEDIT=deploy\tools\rcedit-x64.exe"
if exist "dist\cache\winCodeSign-2.6.0\rcedit-x64.exe" set "RCEDIT=dist\cache\winCodeSign-2.6.0\rcedit-x64.exe"
if not exist "%RCEDIT%" call :fetch_rcedit
if not exist "%RCEDIT%" (
echo [warn] rcedit unavailable, exe icon skipped
exit /b 0
)
"%RCEDIT%" "%CONSOLE_OUT%\Scoreboard Console.exe" ^
--set-icon "console\build\icon.ico" ^
--set-version-string "ProductName" "Scoreboard Console" ^
--set-version-string "FileDescription" "Scoreboard Console" ^
--set-version-string "CompanyName" "AskaEth" ^
--set-file-version "0.1.0" ^
--set-product-version "0.1.0" || exit /b 1
echo app icon stamped
exit /b 0
:fetch_rcedit
set "SEVEN_ZIP="
if exist "%ProgramFiles%\7-Zip\7z.exe" set "SEVEN_ZIP=%ProgramFiles%\7-Zip\7z.exe"
if not defined SEVEN_ZIP if exist "%USERPROFILE%\7z.exe" set "SEVEN_ZIP=%USERPROFILE%\7z.exe"
if not defined SEVEN_ZIP exit /b 0
if not exist "dist\cache" mkdir "dist\cache" 2>nul
if not exist "dist\cache\winCodeSign-2.6.0.7z" (
echo downloading winCodeSign (for rcedit) ...
curl -L --fail --max-time 600 -o "dist\cache\winCodeSign-2.6.0.7z" "https://npmmirror.com/mirrors/electron-builder-binaries/winCodeSign-2.6.0/winCodeSign-2.6.0.7z" || exit /b 0
)
"%SEVEN_ZIP%" x -y -o"dist\cache\winCodeSign-2.6.0" "dist\cache\winCodeSign-2.6.0.7z" rcedit-x64.exe >nul || exit /b 0
exit /b 0