@echo off
title WebRadarCPP — Copy Assets

echo [WebRadarCPP] ========================================
echo [WebRadarCPP] Copying all assets into WebRadarCPP
echo [WebRadarCPP] ========================================
echo.

set ROOT=%~dp0..\..

REM ── 1. Copy webapp (frontend) ──────────────────────────
echo [WebRadarCPP] Step 1/2: Copying webapp frontend...
if exist "%~dp0webapp" (
    echo [WebRadarCPP] Removing old webapp...
    rmdir /S /Q "%~dp0webapp"
)
xcopy /E /I /Y "%ROOT%\src\WebRadar\webapp" "%~dp0webapp"
if %ERRORLEVEL% neq 0 (
    echo [WebRadarCPP] ERROR: Copy webapp failed!
    pause
    exit /b 1
)
echo [WebRadarCPP] Webapp copied OK.
echo.

REM ── 2. Copy output (offsets) ───────────────────────────
echo [WebRadarCPP] Step 2/2: Copying offsets (output/)...
if exist "%~dp0output" (
    echo [WebRadarCPP] Removing old output...
    rmdir /S /Q "%~dp0output"
)
xcopy /E /I /Y "%ROOT%\output" "%~dp0output"
if %ERRORLEVEL% neq 0 (
    echo [WebRadarCPP] ERROR: Copy offsets failed!
    pause
    exit /b 1
)
echo [WebRadarCPP] Offsets copied OK.
echo.

echo [WebRadarCPP] ========================================
echo [WebRadarCPP] WebRadarCPP is now STANDALONE!
echo [WebRadarCPP] ========================================
echo.
dir /B "%~dp0"
echo.
echo Now run: build_cpp.bat
echo.
pause
