From 7243de93ce22ba1d29c709a80a832ab1dadd7612 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Wed, 9 Sep 2026 19:34:28 +0800 Subject: [PATCH] =?UTF-8?q?build:=20=E8=BF=90=E8=A1=8C=E6=97=B6=E5=8F=AA?= =?UTF-8?q?=E8=A3=85=E4=B8=80=E6=AC=A1=EF=BC=8C=E9=81=BF=E5=85=8D=E8=A6=86?= =?UTF-8?q?=E7=9B=96=E5=8F=AA=E8=AF=BB=E6=96=87=E4=BB=B6=E8=A2=AB=E6=8B=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/build.bat | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/deploy/build.bat b/deploy/build.bat index 6d48f17..f5d2f15 100644 --- a/deploy/build.bat +++ b/deploy/build.bat @@ -39,12 +39,12 @@ cd .. echo === [5/5] assemble portable console === REM Old build may still be running; .pak files from the electron zip are read-only, -REM so full directory removal is fragile. Overwrite in place instead: only wipe our -REM own resources\app, let the runtime files be overwritten. +REM so full directory removal is fragile. Overwrite in place instead: the runtime is +REM installed once, and only our own resources\app is wiped on every build. taskkill /im "Scoreboard Console.exe" /f >nul 2>&1 taskkill /im scoreboard.exe /f >nul 2>&1 if not exist "%CONSOLE_OUT%" mkdir "%CONSOLE_OUT%" || exit /b 1 -xcopy /e /i /y "console\node_modules\electron\dist" "%CONSOLE_OUT%" >nul || exit /b 1 +if not exist "%CONSOLE_OUT%\Scoreboard Console.exe" call :install_runtime || exit /b 1 if exist "%CONSOLE_OUT%\resources\app" rmdir /s /q "%CONSOLE_OUT%\resources\app" mkdir "%CONSOLE_OUT%\resources\app" 2>nul xcopy /e /i /y "console\main" "%CONSOLE_OUT%\resources\app\main" >nul || exit /b 1 @@ -54,7 +54,6 @@ REM config.json must sit next to the exe: the console resolves it from the exe d copy /y "console\config.json" "%CONSOLE_OUT%\config.json" >nul || exit /b 1 copy /y "dist\scoreboard.exe" "%CONSOLE_OUT%\scoreboard.exe" >nul || exit /b 1 copy /y "config.yaml" "%CONSOLE_OUT%\config.yaml" >nul || exit /b 1 -if exist "%CONSOLE_OUT%\electron.exe" ren "%CONSOLE_OUT%\electron.exe" "Scoreboard Console.exe" echo. echo === 构建完成 === @@ -77,3 +76,9 @@ del /q electron-dl.zip echo electron.exe> node_modules\electron\path.txt echo electron binary placed exit /b 0 + +REM ---- install electron runtime once ------------------------------------------- +:install_runtime +xcopy /e /i /y /r "console\node_modules\electron\dist" "%CONSOLE_OUT%" >nul || exit /b 1 +if exist "%CONSOLE_OUT%\electron.exe" ren "%CONSOLE_OUT%\electron.exe" "Scoreboard Console.exe" +exit /b 0