65 lines
1.6 KiB
Batchfile
65 lines
1.6 KiB
Batchfile
@echo off
|
|
title GODCWAK Launcher
|
|
color 0A
|
|
|
|
echo.
|
|
echo =========================================
|
|
echo GODCWAK v1.0 - Starting...
|
|
echo =========================================
|
|
echo.
|
|
|
|
:: Change to the folder this .bat lives in so relative imports work
|
|
cd /d "%~dp0"
|
|
|
|
:: Prefer the project virtual environment, then the Python launcher, then PATH.
|
|
set PYTHON_EXE=
|
|
set PYTHON_ARGS=
|
|
if exist "%~dp0.venv\Scripts\python.exe" (
|
|
set "PYTHON_EXE=%~dp0.venv\Scripts\python.exe"
|
|
) else (
|
|
py -3 --version >nul 2>&1
|
|
if %ERRORLEVEL% EQU 0 (
|
|
set "PYTHON_EXE=py"
|
|
set "PYTHON_ARGS=-3"
|
|
) else (
|
|
python --version >nul 2>&1
|
|
if %ERRORLEVEL% EQU 0 (
|
|
set "PYTHON_EXE=python"
|
|
)
|
|
)
|
|
)
|
|
|
|
if "%PYTHON_EXE%"=="" (
|
|
echo [ERROR] Python 3 not found. Install Python or create .venv first.
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
:: bug #36: first-run detection — install requirements if not yet done
|
|
set SENTINEL="%~dp0.installed"
|
|
if not exist %SENTINEL% (
|
|
echo [SETUP] First run detected — installing requirements...
|
|
"%PYTHON_EXE%" %PYTHON_ARGS% -m pip install -r requirements.txt
|
|
if %ERRORLEVEL% NEQ 0 (
|
|
echo [ERROR] pip install failed. Check requirements.txt and your Python environment.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
echo. > %SENTINEL%
|
|
echo [SETUP] Dependencies installed successfully.
|
|
echo.
|
|
)
|
|
|
|
:: Launch
|
|
"%PYTHON_EXE%" %PYTHON_ARGS% main.py
|
|
|
|
:: If Python exited with an error, pause so the user can read it
|
|
if %ERRORLEVEL% NEQ 0 (
|
|
echo.
|
|
echo [!] GODCWAK exited with error code %ERRORLEVEL%
|
|
echo Check the output above for details.
|
|
echo.
|
|
pause
|
|
)
|