Skip to content

Commit 0063913

Browse files
mzuennimpsijm
authored andcommitted
allow latex in subdirs
1 parent b867df2 commit 0063913

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

bin/latex.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
ensure_symlink,
1818
exec_command,
1919
fatal,
20+
is_windows,
2021
message,
2122
MessageType,
2223
PrintBar,
@@ -232,24 +233,20 @@ def problem_data(problem: "Problem", language: str):
232233

233234

234235
def make_environment() -> dict[str, str]:
236+
sep = ";" if is_windows() else ":"
235237
env = os.environ.copy()
236238
# Search the contest directory and the latex directory.
237239
latex_paths = [
238-
Path.cwd(),
239-
Path.cwd() / "solve_stats",
240-
Path.cwd() / "solve_stats" / "activity",
241-
config.TOOLS_ROOT / "latex",
240+
f"{Path.cwd()}",
241+
f"{Path.cwd() / 'solve_stats'}//",
242+
f"{Path.cwd() / 'latex'}//",
243+
f"{config.TOOLS_ROOT / 'latex'}//",
242244
]
243-
texinputs = ""
244-
for p in latex_paths:
245-
texinputs += str(p) + ";"
245+
texinputs = sep.join(latex_paths) + sep
246246
if config.args.verbose >= 2:
247247
print(f"export TEXINPUTS='{texinputs}'", file=sys.stderr)
248248
if "TEXINPUTS" in env:
249-
prev = env["TEXINPUTS"]
250-
if len(prev) > 0 and prev[-1] != ";":
251-
prev += ";"
252-
texinputs = prev + texinputs
249+
texinputs = texinputs + env["TEXINPUTS"]
253250
env["TEXINPUTS"] = texinputs
254251
return env
255252

0 commit comments

Comments
 (0)