更新 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 [4/6] Clean build directory...
if exist "dist" rd /s /q "dist"
if exist "build" rd /s /q "build"
if exist "NexusLauncher.spec" del /f "NexusLauncher.spec"
if exist "dist\NexusLauncher.exe" (
echo Attempting to delete existing exe...
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 [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 (
echo Error: Failed to build EXE
pause
@@ -47,15 +57,14 @@ if %errorlevel% neq 0 (
)
echo.
echo [6/6] Copy EXE to template folder...
copy /y /b "dist\NexusLauncher.exe" "D:\NexusLauncher\NexusLauncher.exe"
echo [6/6] Open EXE folder...
echo.
echo ========================================
echo Build completed!
echo Executable file location: D:\NexusLauncher\NexusLauncher.exe
echo Executable file location: dist\NexusLauncher.exe
echo ========================================
echo.
echo Opening D:\NexusLauncher folder...
start "" "D:\NexusLauncher"
echo Opening dist folder...
start "" "dist"
echo.
pause