summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/webquiz/webquiz.bat
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/webquiz/webquiz.bat')
-rwxr-xr-xMaster/texmf-dist/scripts/webquiz/webquiz.bat26
1 files changed, 21 insertions, 5 deletions
diff --git a/Master/texmf-dist/scripts/webquiz/webquiz.bat b/Master/texmf-dist/scripts/webquiz/webquiz.bat
index c92a60d3a29..89c05730fa4 100755
--- a/Master/texmf-dist/scripts/webquiz/webquiz.bat
+++ b/Master/texmf-dist/scripts/webquiz/webquiz.bat
@@ -1,14 +1,30 @@
@echo off
+rem WebQuiz batch file to find and launch python executable
+
+rem Set TEXMF to root TeX directory and look for webquiz.py in scripts/webquiz
setlocal enableextensions
-rem assuming the main script is in the same directory
-if not exist "%~dpn0.py" (
- echo %~nx0: main script "%~dpn0.py" not found>&2
+for /F "tokens=*" %%i in ('kpsewhich -var-value TEXMFMAIN') do (SET TEXMF=%%i)
+
+rem First look for webquiz.py in the current directory
+set WebQuiz="webquiz.py"
+if not exist %WebQuiz% (
+ if exist "%TEXMF%/scripts/webquiz/webquiz.py" (
+ set WebQuiz="%TEXMF%/scripts/webquiz/webquiz.py"
+ )
+)
+rem
+rem exit with an error if webquiz.py has not been found
+if not exist %WebQuiz% (
+ echo WebQuiz executable not found. Please check that WebQuiz is properly installed>&2
exit /b 1
)
-rem check if interpreter is on the PATH
+
+rem check for the python interpreter in the PATH
for %%I in (python.exe) do set "PYTHONEXE=%%~$PATH:I"
if not defined PYTHONEXE (
echo %~nx0: Python interpreter not installed or not on the PATH>&2
exit /b 1
)
-"%PYTHONEXE%" "%~dpn0.py" %*
+
+rem launch webquiz
+"%PYTHONEXE%" %WebQuiz% %*