|
1 | 1 | @echo off |
2 | | -setlocal EnableExtensions |
| 2 | +setlocal |
3 | 3 |
|
4 | | -rem ---- shared slim runtime ---- |
5 | | -set "RUNTIME=%USERPROFILE%\.wurst\wurst-runtime\bin\java.exe" |
| 4 | +rem Save current code page |
| 5 | +for /f "tokens=2 delims=: " %%A in ('chcp') do set "_OLDCP=%%A" |
6 | 6 |
|
7 | | -rem script directory (trailing backslash) |
| 7 | +rem Switch to UTF-8 for this session |
| 8 | +chcp 65001 >NUL |
| 9 | + |
| 10 | +rem Resolve script dir |
8 | 11 | set "DIR=%~dp0" |
9 | 12 |
|
10 | | -if not exist "%RUNTIME%" ( |
11 | | - echo [wurstscript] ERROR: Runtime not found: |
12 | | - echo(%RUNTIME% |
13 | | - echo Reinstall Wurstscript via the VSCode extension. |
14 | | - exit /b 1 |
| 13 | +set "JAVA=%DIR%wurst-runtime\bin\java.exe" |
| 14 | +set "GRILL_JAR=%DIR%grill\grill.jar" |
| 15 | + |
| 16 | +if not exist "%GRILL_JAR%" ( |
| 17 | + echo [grill] ERROR: Missing jar. Searched: |
| 18 | + echo %GRILL_JAR% |
| 19 | + rem fallback to ../grill if you want: |
| 20 | + set "GRILL_JAR=%DIR%..\grill\grill.jar" |
| 21 | + if not exist "%GRILL_JAR%" ( |
| 22 | + echo %GRILL_JAR% |
| 23 | + goto :restore |
| 24 | + ) |
15 | 25 | ) |
16 | 26 |
|
17 | | -rem ---- fixed jar location(s), no wildcards ---- |
18 | | -set "JAR=%DIR%grill\grill.jar" |
19 | | -if not exist "%JAR%" set "JAR=%DIR%..\grill\grill.jar" |
20 | | -if not exist "%JAR%" ( |
21 | | - echo [grill] ERROR: Missing jar: |
22 | | - echo(%DIR%grill\grill.jar |
23 | | - echo or |
24 | | - echo(%DIR%..\grill\grill.jar |
25 | | - exit /b 1 |
| 27 | +if not exist "%JAVA%" ( |
| 28 | + echo [grill] ERROR: Bundled runtime not found or not executable at: |
| 29 | + echo %JAVA% |
| 30 | + echo Please reinstall wurstscript via the VS Code extension. |
| 31 | + goto :restore |
26 | 32 | ) |
27 | 33 |
|
28 | | -rem Optional JVM flags via env var, e.g. set WURST_JAVA_OPTS=-Xmx1g |
29 | | -"%RUNTIME%" %WURST_JAVA_OPTS% -jar "%JAR%" %* |
| 34 | +"%JAVA%" -Dfile.encoding=UTF-8 -jar "%GRILL_JAR%" %* |
| 35 | + |
| 36 | +:restore |
| 37 | +rem Restore previous code page if we captured it |
| 38 | +if defined _OLDCP chcp %_OLDCP% >NUL |
| 39 | + |
30 | 40 | endlocal |
0 commit comments