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);