@echo off
chcp 65001 >nul
setlocal EnableExtensions
set "ROOT=%~dp0"
set "HELPER=%ROOT%Engine\CleanupAdmin\bin\Release\net8.0-windows\ONE.CleanupAdmin.exe"
if not exist "%HELPER%" set "HELPER=%ROOT%CleanupAdmin\bin\Release\net8.0-windows\ONE.CleanupAdmin.exe"

if exist "%HELPER%" (
  "%HELPER%" %*
  exit /b %ERRORLEVEL%
)

if exist "%ROOT%CleanupAdmin\CleanupAdmin.csproj" (
  dotnet run --project "%ROOT%CleanupAdmin\CleanupAdmin.csproj" -c Release -- %*
  exit /b %ERRORLEVEL%
)

echo ONE.CleanupAdmin helper not found.
echo Expected: "%ROOT%CleanupAdmin\CleanupAdmin.csproj"
exit /b 1
