summaryrefslogtreecommitdiff
path: root/Master/bin/win32/texworks.bat
blob: f9e8b227e10044c76a442be4bb8dce4ee1a6b40e (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
@echo off
rem Start-up script for TeXworks
rem
rem Copyright 2009 by Tomasz M. Trzeciak
rem Public Domain

setlocal enableextensions
rem Get installation root (should be two levels up)
for %%I in ("%~dp0..\..") do (set TEXROOT=%%~fI)
rem Add bin dir to path
path %TEXROOT%\bin\win32;%PATH%
rem Ask kpsewhich about TEXMFCONFIG location
for /f "delims=" %%I in ('kpsewhich --var-value=TEXMFCONFIG') do (
  set TW_INIPATH=%%~fI\texworks
  set TW_LIBPATH=%%~fI\texworks
)
rem Settings dir needs to exist or TeXworks will fall back on the registry
if not exist "%TW_INIPATH%\" mkdir "%TW_INIPATH%"
if not exist "%TW_INIPATH%\" goto :noinipath

rem Start TeXworks editor without blocking command line
start "TeX Works" "%TEXROOT%\tlpkg\texworks\texworks.exe" %*
goto :eof

:noinipath
echo %~nx0: could not create directory: %TW_INIPATH%>&2
exit /b 1