From 04844e8a548bd7fb1c9caaa3607ba096696dad26 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Tue, 13 Sep 2022 12:16:36 -0500 Subject: [PATCH] Fix the Mojo::Home usage if the app is run from outside the project root In order for Mojo::Home detect to return the correct project root directory in all cases the application class needs to be passed to the detect method. --- lib/WeBWorK3/Controller/Logger.pm | 2 +- lib/WeBWorK3/Utils/Settings.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/WeBWorK3/Controller/Logger.pm b/lib/WeBWorK3/Controller/Logger.pm index dec74ace..af141af8 100644 --- a/lib/WeBWorK3/Controller/Logger.pm +++ b/lib/WeBWorK3/Controller/Logger.pm @@ -7,7 +7,7 @@ use Mojo::Home; use Mojo::Log; use JSON qw/decode_json/; -my $clientLogFile = Mojo::Log->new(path => Mojo::Home->new->detect->child('logs', 'clientLog.log')); +my $clientLogFile = Mojo::Log->new(path => Mojo::Home->new->detect('WeBWorK3')->child('logs', 'clientLog.log')); sub clientLog ($c) { my $rawJSON = $c->req->body; diff --git a/lib/WeBWorK3/Utils/Settings.pm b/lib/WeBWorK3/Utils/Settings.pm index 3756fc5e..edef45b5 100644 --- a/lib/WeBWorK3/Utils/Settings.pm +++ b/lib/WeBWorK3/Utils/Settings.pm @@ -32,7 +32,7 @@ load the default settings from the conf/course_settings.yaml file =cut sub getDefaultCourseSettings () { - return LoadFile(Mojo::Home->new->detect->child('conf', 'course_defaults.yml')); + return LoadFile(Mojo::Home->new->detect('WeBWorK3')->child('conf', 'course_defaults.yml')); } my @course_setting_categories = qw/email optional general permissions problem problem_set/;