Skip to content

Commit

Permalink
Fix the check_latex script.
Browse files Browse the repository at this point in the history
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 openwebwork#2543.
  • Loading branch information
drgrice1 committed Aug 28, 2024
1 parent 16de8df commit 614e477
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions bin/check_latex
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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:"
Expand Down

0 comments on commit 614e477

Please sign in to comment.