summaryrefslogtreecommitdiff
path: root/tools/new-nrl-opmode.bat
blob: c2f37ce73d2f17fc4541d6bb748be2dde76593a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@echo off
rem ===================================================================
rem  NRL - Create a New OpMode  (double-click launcher, Windows)
rem  Scaffolds a robot OpMode from a minimal template, then opens it.
rem ===================================================================
setlocal
title NRL - Create a New OpMode

rem This .bat lives in <repo>\tools\ ; the generator sits next to it.
set "SCRIPT=%~dp0nrl_new_opmode.py"

rem Find a usable Python 3 (real py/python); if none is found, ensure-python.ps1
rem installs one automatically and prints its path.
set "PYEXE="
for /f "usebackq delims=" %%i in (`powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0ensure-python.ps1"`) do set "PYEXE=%%i"
if not defined PYEXE goto no_python
"%PYEXE%" "%SCRIPT%" --open %*
goto end

:no_python
echo.
echo [error] Python 3 was not found and could not be installed automatically.
echo   Install Python 3 from https://www.python.org/downloads/ and re-run,
echo   ticking "Add python.exe to PATH" during setup.

:end
echo.
if not defined NRL_NO_PAUSE pause
endlocal