@echo off
setlocal enabledelayedexpansion

REM Get the directory of this script
set "SCRIPT_DIR=%~dp0"
set "TRACKER_DIR=%SCRIPT_DIR%.."
set "EXE_PATH=%TRACKER_DIR%\track_progress.exe"
set "PY_PATH=%TRACKER_DIR%\track_progress.py"

REM Check if executable exists
if exist "%EXE_PATH%" (
    echo Running Progress Tracker (executable version)...
    "%EXE_PATH%" %*
) else (
    echo Executable not found, trying Python version...
    if exist "%PY_PATH%" (
        echo Running Progress Tracker (Python version)...
        python "%PY_PATH%" %*
    ) else (
        echo Error: Neither executable nor Python script found at:
        echo - %EXE_PATH%
        echo - %PY_PATH%
        exit /b 1
    )
)

if %ERRORLEVEL% EQU 0 (
    echo Progress tracking completed successfully!
) else (
    echo Error running progress tracker! (Exit code: %ERRORLEVEL%)
)
pause