App-Ariza.git | resources/templates/ | launcher-windows.cmd.j2
@echo off
rem {{ app_display }} {{ app_version }} -- self-contained bundle launcher.
rem
rem Generated by ariza for {{ platform }}. Everything this script needs is
rem inside the directory above it; nothing outside the bundle is read, and
rem nothing is installed.
setlocal enableextensions
{% if updates_enabled %}"%~dp0{{ app_exec }}.exe" %*
exit /b %ERRORLEVEL%
{% else %}
{% endif %}rem %~dp0 is this script's directory with a trailing backslash, already
rem resolved, so the bundle root is one level up.
for %%I in ("%~dp0..") do set "BUNDLE_ROOT=%%~fI"
set "ARIZA_RAKU=%BUNDLE_ROOT%\rakudo\bin\raku.exe"
if not exist "%ARIZA_RAKU%" (
echo {{ app_display }}: this bundle is incomplete - no interpreter at "%ARIZA_RAKU%" 1>&2
echo Unpack the whole archive and run this script from inside it. 1>&2
exit /b 1
)
rem The bundle is the only module repository -- the bundled runtime's own
rem vendor repository, which is what makes the shipped bytecode usable
rem from here rather than only where it was built.
set "RAKULIB=inst#%BUNDLE_ROOT%\{{ site_win }}"
set "PERL6LIB="
set "NOTCURSES_NATIVE_DATA_DIR=%BUNDLE_ROOT%\native"
{%- if sqlcipher %}
rem Each set prepends, so lower-priority SQLCipher is applied first. The
rem final PATH starts with Notcurses, then SQLCipher, then the inherited PATH.
set "PATH=%BUNDLE_ROOT%\{{ sqlcipher_dir_win }};%PATH%"
{%- endif %}
{%- if notcurses %}
set "PATH=%BUNDLE_ROOT%\{{ notcurses_dir_win }};%PATH%"
{%- endif %}
{%- if sqlcipher %}
set "DBIISH_SQLCIPHER_LIB=%BUNDLE_ROOT%\{{ sqlcipher_lib_win }}"
{%- endif %}
set "ARIZA_STATE_DIR=%LOCALAPPDATA%\{{ app_exec }}"
if not exist "%ARIZA_STATE_DIR%\.first-run" (
echo {{ app_display }}: first launch can take a few seconds. Later ones are instant. 1>&2
if not exist "%ARIZA_STATE_DIR%" mkdir "%ARIZA_STATE_DIR%" 2>nul
if exist "%ARIZA_STATE_DIR%" type nul >"%ARIZA_STATE_DIR%\.first-run" 2>nul
)
"%ARIZA_RAKU%" "%BUNDLE_ROOT%\{{ target_win }}" %*
exit /b %ERRORLEVEL%