build: 运行时只装一次,避免覆盖只读文件被拒
This commit is contained in:
1 parent
1af62a690e
commit
7243de93ce
1 file changed
+9
-4
+9
-4
@@ -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
|
||||
Reference in new issue
Block a user