Files
NexusLauncher/build.bat
2026-01-21 12:43:07 +08:00

71 lines
1.8 KiB
Batchfile

@echo off
echo ========================================
echo NexusLauncher Build Script
echo ========================================
echo.
echo [1/6] Check Python version...
python --version
if %errorlevel% neq 0 (
echo Error: Python not found, please ensure Python 3.11 or higher is installed
pause
exit /b 1
)
echo.
echo [2/6] Install dependencies...
pip install -r requirements.txt
if %errorlevel% neq 0 (
echo Error: Failed to install dependencies
pause
exit /b 1
)
echo.
echo [3/6] Close running instances...
taskkill /f /im NexusLauncher.exe 2>nul
if %errorlevel% equ 0 (
echo Closed NexusLauncher.exe
timeout /t 2 /nobreak >nul
) else (
echo No running instances found
)
echo.
echo [4/6] Clean build directory...
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
if %errorlevel% neq 0 (
echo Error: Failed to build EXE
pause
exit /b 1
)
echo.
echo [6/6] Open EXE folder...
echo.
echo ========================================
echo Build completed!
echo Executable file location: dist\NexusLauncher.exe
echo ========================================
echo.
echo Opening dist folder...
start "" "dist"
echo.
pause