3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 13:59:47 +01:00

Plugins: Fix path loading

This commit is contained in:
Pragmatic Software 2019-12-21 19:33:53 -08:00
parent 0155fb27d8
commit 274ee8dcd6

View File

@ -87,13 +87,10 @@ sub load {
unshift @INC, $path; unshift @INC, $path;
} }
my $class = $path . "/$plugin";
$class =~ s,[/\\],::,g;
$self->{pbot}->{refresher}->{refresher}->refresh_module("$path/$plugin.pm"); $self->{pbot}->{refresher}->{refresher}->refresh_module("$path/$plugin.pm");
my $ret = eval { my $ret = eval {
eval "require $class"; require "$path/$plugin.pm";
if ($@) { if ($@) {
chomp $@; chomp $@;
@ -102,6 +99,7 @@ sub load {
} }
$self->{pbot}->{logger}->log("Loading $plugin\n"); $self->{pbot}->{logger}->log("Loading $plugin\n");
my $class = "Plugins::$plugin";
my $mod = $class->new(pbot => $self->{pbot}, %conf); my $mod = $class->new(pbot => $self->{pbot}, %conf);
$self->{plugins}->{$plugin} = $mod; $self->{plugins}->{$plugin} = $mod;
$self->{pbot}->{refresher}->{refresher}->update_cache("$path/$plugin.pm"); $self->{pbot}->{refresher}->{refresher}->update_cache("$path/$plugin.pm");