更新 build.bat

This commit is contained in:
2026-01-21 12:43:07 +08:00
parent fb18b25172
commit b660984e23

View File

@@ -33,13 +33,23 @@ if %errorlevel% equ 0 (
echo. echo.
echo [4/6] Clean build directory... echo [4/6] Clean build directory...
if exist "dist" rd /s /q "dist" if exist "dist\NexusLauncher.exe" (
if exist "build" rd /s /q "build" echo Attempting to delete existing exe...
if exist "NexusLauncher.spec" del /f "NexusLauncher.spec" del /f /q "dist\NexusLauncher.exe" 2>nul
if %errorlevel% neq 0 (
echo Warning: Could not delete dist\NexusLauncher.exe, it may be in use
echo Waiting 3 seconds...
timeout /t 3 /nobreak >nul
del /f /q "dist\NexusLauncher.exe" 2>nul
)
)
if exist "dist" rd /s /q "dist" 2>nul
if exist "build" rd /s /q "build" 2>nul
if exist "NexusLauncher.spec" del /f "NexusLauncher.spec" 2>nul
echo. echo.
echo [5/6] Build EXE using PyInstaller... echo [5/6] Build EXE using PyInstaller...
python -m PyInstaller --noconfirm --onefile --windowed --name "NexusLauncher" --icon="icons/NexusLauncher.ico" --add-data "icons;icons" main.py python -m PyInstaller --noconfirm --onefile --windowed --name "NexusLauncher" --icon "icons/NexusLauncher.ico" --add-data "icons;icons" main.py
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
echo Error: Failed to build EXE echo Error: Failed to build EXE
pause pause
@@ -47,15 +57,14 @@ if %errorlevel% neq 0 (
) )
echo. echo.
echo [6/6] Copy EXE to template folder... echo [6/6] Open EXE folder...
copy /y /b "dist\NexusLauncher.exe" "D:\NexusLauncher\NexusLauncher.exe"
echo. echo.
echo ======================================== echo ========================================
echo Build completed! echo Build completed!
echo Executable file location: D:\NexusLauncher\NexusLauncher.exe echo Executable file location: dist\NexusLauncher.exe
echo ======================================== echo ========================================
echo. echo.
echo Opening D:\NexusLauncher folder... echo Opening dist folder...
start "" "D:\NexusLauncher" start "" "dist"
echo. echo.
pause pause