summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xMaster/bin/win32/texworks.bat30
1 files changed, 24 insertions, 6 deletions
diff --git a/Master/bin/win32/texworks.bat b/Master/bin/win32/texworks.bat
index 0b8c38d3102..d8f352b2e43 100755
--- a/Master/bin/win32/texworks.bat
+++ b/Master/bin/win32/texworks.bat
@@ -1,9 +1,27 @@
@echo off
-rem Launcher script for texworks
+rem Start-up script for TeXworks
+rem
+rem Copyright 2009 by Tomasz M. Trzeciak
+rem Public Domain
-rem Get TL root (should be two levels up)
-for %%I in (%~dp0..\..) do (set tlroot=%%~fI)
+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 %tlroot%\bin\win32;%path%
-rem Start texworks editor
-start "" "%tlroot%\tlpkg\texworks\texworks.exe" %* \ No newline at end of file
+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 "" "%TEXROOT%\tlpkg\texworks\texworks.exe" %*
+goto :eof
+
+:noinipath
+echo %~nx0: could not create directory: %TW_INIPATH%>&2
+exit /b 1 \ No newline at end of file