From 640994fd41de27f14fd57d2347a013c07cc70fa5 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Wed, 28 Aug 2024 14:58:06 -0500 Subject: [PATCH] Fix the `check_latex` script. The addition of the requirement of PG files for hardcopy (namely the `pg.sty` file), means that the `check_latex` script needs to know where the pg directory is. So find that the same way the webwork2 app does. This fixes issue #2543. --- bin/check_latex | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/check_latex b/bin/check_latex index 4c55da860b..bcf070cb6f 100755 --- a/bin/check_latex +++ b/bin/check_latex @@ -27,9 +27,17 @@ use feature 'say'; BEGIN { use Mojo::File qw(curfile); - use Env qw(WEBWORK_ROOT); + use YAML::XS qw(LoadFile); + use Env qw(WEBWORK_ROOT PG_ROOT); - $WEBWORK_ROOT = curfile->dirname->dirname; + $WEBWORK_ROOT = curfile->dirname->dirname->to_string; + + # Load the configuration file to obtain the PG root directory. + my $config_file = "$WEBWORK_ROOT/conf/webwork2.mojolicious.yml"; + $config_file = "$WEBWORK_ROOT/conf/webwork2.mojolicious.dist.yml" unless -e $config_file; + my $config = LoadFile($config_file); + + $PG_ROOT = $config->{pg_dir}; } use File::Temp qw(tempdir);