@echo off
setlocal

fsutil dirty query %systemdrive% >nul 2>&1
if errorlevel 1 (
    powershell -NoProfile -ExecutionPolicy Bypass -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
    exit /b
)

set "SCRIPT_DIR=%~dp0"
set "JAR_PATH=%SCRIPT_DIR%DogeVpsDesktop.jar"
set "RUNTIME_PATH=%SCRIPT_DIR%runtime\sing-box.exe"

if exist "%RUNTIME_PATH%" (
    set "DOGEVPS_SING_BOX=%RUNTIME_PATH%"
)

if not exist "%JAR_PATH%" (
    echo Missing DogeVpsDesktop.jar in:
    echo %SCRIPT_DIR%
    pause
    exit /b 1
)

java -jar "%JAR_PATH%"
