@echo off
setlocal
cd /d "%~dp0"

set "PY="
if exist "%~dp0runtime\python.exe" set "PY=%~dp0runtime\python.exe"
if not defined PY (
  where python >nul 2>&1 && set "PY=python"
)
if not defined PY (
  where py >nul 2>&1 && set "PY=py -3"
)

echo DSD-P 布局编辑器
echo 浏览器打开: http://127.0.0.1:8765/
echo 关闭本窗口即可停止服务。
echo.

start "" "http://127.0.0.1:8765/"

if defined PY (
  %PY% -m http.server 8765
  goto :eof
)

echo 未找到便携 Python（runtime\python.exe）或系统 Python，改用 PowerShell 内置服务...
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0start.ps1" -NoBrowser
pause
