From 614e47793f1d8303b8783c1e8bb58a69fcb70b41 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 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/check_latex b/bin/check_latex index 4c55da860b..0eb04b5131 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); @@ -45,7 +53,7 @@ my $ce = WeBWorK::CourseEnvironment->new({ webwork_dir => $ENV{WEBWORK_ROOT} }); my $temp_dir = eval { tempdir('check_latex_XXXXXXXX') }; die $@ if $@; - +say $ce->{pg}{directories}{assetsTex}; my $latex_cmd = "cd $temp_dir && " . "TEXINPUTS=$ENV{WEBWORK_ROOT}/bin:"