@echo off
setlocal

:: Define repo paths
set "SCRIPTS_DIR=%~dp0"
set "SOUNDS_DIR=%~dp0sounds"

:: Try to use system git, fallback to GitPortable
where git >nul 2>nul
if %errorlevel%==0 (
    set "GIT=git"
) else if exist "%~dp0GitPortable\cmd\git.exe" (
    set "GIT=%~dp0GitPortable\cmd\git.exe"
) else (
    echo Git not found. Please install Git or place GitPortable in the same folder.
    exit /b 1
)

:: Reset scripts repo
echo Resetting scripts repo to remote...
pushd "%SCRIPTS_DIR%"
call "%GIT%" fetch origin
call "%GIT%" reset --hard origin/main
popd

:: Reset sounds repo
echo Resetting sounds repo to remote...
pushd "%SOUNDS_DIR%"
call "%GIT%" fetch origin
call "%GIT%" reset --hard origin/main
popd

echo Done.
endlocal
