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

Plugins: use plugin_dir registry value

This commit is contained in:
Pragmatic Software 2019-12-21 19:01:59 -08:00
parent 532fc9c8fc
commit 755cb0d571

View File

@ -47,7 +47,7 @@ sub autoload {
return if $self->{pbot}->{registry}->get_value('plugins', 'noautoload'); return if $self->{pbot}->{registry}->get_value('plugins', 'noautoload');
my $path = $self->{pbot}->{registry}->get_value('plugins', 'path') // 'Plugins'; my $path = $self->{pbot}->{registry}->get_value('general', 'plugin_dir') // 'Plugins';
$self->{pbot}->{logger}->log("Loading plugins ...\n"); $self->{pbot}->{logger}->log("Loading plugins ...\n");
my $plugin_count = 0; my $plugin_count = 0;
@ -81,7 +81,7 @@ sub load {
return if $self->{pbot}->{registry}->get_value('plugins', 'disabled'); return if $self->{pbot}->{registry}->get_value('plugins', 'disabled');
my $path = $self->{pbot}->{registry}->get_value('plugins', 'path') // 'Plugins'; my $path = $self->{pbot}->{registry}->get_value('general', 'plugin_dir') // 'Plugins';
if (not grep { $_ eq $path } @INC) { if (not grep { $_ eq $path } @INC) {
unshift @INC, $path; unshift @INC, $path;
@ -130,7 +130,7 @@ sub unload {
$self->{pbot}->{logger}->log("Warning: got error unloading plugin $plugin: $@\n"); $self->{pbot}->{logger}->log("Warning: got error unloading plugin $plugin: $@\n");
} }
my $path = $self->{pbot}->{registry}->get_value('plugins', 'path') // 'Plugins'; my $path = $self->{pbot}->{registry}->get_value('general', 'plugin_dir') // 'Plugins';
my $class = $path; my $class = $path;
$class =~ s,[/\\],::,g; $class =~ s,[/\\],::,g;