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

setlocal enableextensions
rem Get TL installation root (w/o trailing backslash)
set TEXROOT=%~dp0:
set TEXROOT=%TEXROOT:\bin\win32\:=%
rem Add bin dir to path
path %TEXROOT%\bin\win32;%PATH%
rem Ask kpsewhich about TEXMFCONFIG location
for /f "delims=" %%I in ('call "%~dp0kpsewhich.exe" --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