summaryrefslogtreecommitdiff
path: root/Master/bin/win32/texworks.bat
blob: 57af57a489395aff4e4e3d56633ed8e9fc8fb9da (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" /D"%TEXROOT%\tlpkg\texworks" "%TEXROOT%\tlpkg\texworks\texworks.exe" %*
goto :eof

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