From 184ff7fc7f99e654a5e890ad44162fd7acdb2c37 Mon Sep 17 00:00:00 2001 From: David Allemang Date: Sat, 12 Mar 2022 08:37:12 -0500 Subject: [PATCH] Fix malformed TEXINPUTS on Windows. Use `;` as the path separator on Windows since drive letters contain the `:` symbol. --- dungeonsheets/latex.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dungeonsheets/latex.py b/dungeonsheets/latex.py index ac6db6b..e6ba542 100644 --- a/dungeonsheets/latex.py +++ b/dungeonsheets/latex.py @@ -1,3 +1,4 @@ +import pathlib from pathlib import Path import os import re @@ -73,8 +74,9 @@ def create_latex_pdf( module_root = Path(__file__).parent / "modules/" module_dirs = [module_root / mdir for mdir in ["DND-5e-LaTeX-Template"]] log.debug(f"Loading additional modules from {module_dirs}.") - texinputs = f".:{':'.join(str(d) for d in module_dirs)}:{module_root}:{tex_env}" - environment['TEXINPUTS'] = texinputs + texinputs = ['.', *module_dirs, module_root, tex_env] + separator = ';' if isinstance(module_root, pathlib.WindowsPath) else ':' + environment['TEXINPUTS'] = separator.join(str(path) for path in texinputs) passes = 2 if use_dnd_decorations else 1 log.debug(tex_command_line) log.debug("LaTeX command: %s" % " ".join(tex_command_line))