[Rt-commit] r14534 - rt/3.8/trunk/lib
ruz at bestpractical.com
ruz at bestpractical.com
Fri Jul 25 19:46:18 EDT 2008
Author: ruz
Date: Fri Jul 25 19:46:17 2008
New Revision: 14534
Modified:
rt/3.8/trunk/lib/RT.pm.in
Log:
* add PluginDirs
Modified: rt/3.8/trunk/lib/RT.pm.in
==============================================================================
--- rt/3.8/trunk/lib/RT.pm.in (original)
+++ rt/3.8/trunk/lib/RT.pm.in Fri Jul 25 19:46:17 2008
@@ -562,31 +562,48 @@
return \@PLUGINS;
}
-=head2 InitPluginPaths
+=head2 PluginDirs
-Push plugin's lib paths into @INC
+Takes optional subdir (e.g. po, lib, etc.) and return plugins' dirs that exist.
=cut
-sub InitPluginPaths {
+sub PluginDirs {
my $self = shift;
+ my $subdir = shift;
+ my @res;
foreach my $plugin (grep $_, RT->Config->Get('Plugins')) {
my $plugindir = $plugin;
$plugindir =~ s/::/-/g;
- next unless -d $RT::LocalPluginPath."/$plugindir/lib";
+ my $path = $RT::LocalPluginPath. "/$plugindir";
+ $path .= "/$subdir" if defined $subdir && length $subdir;
+ next unless -d $path;
+ push @res, $path;
+ }
+ return @res;
+}
+
+=head2 InitPluginPaths
+
+Push plugins' lib paths into @INC right after F<local/lib>.
+
+=cut
+
+sub InitPluginPaths {
+ my $self = shift;
+
+ my @lib_dirs = $self->PluginDirs('lib');
- # Splice the plugin's lib dir into @INC;
- my @tmp_inc;
- for (@INC) {
- if ( $_ eq $RT::LocalLibPath) {
- push @tmp_inc, $_, $RT::LocalPluginPath . "/$plugindir/lib";
- } else {
- push @tmp_inc, $_;
- }
+ my @tmp_inc;
+ for (@INC) {
+ if ( $_ eq $RT::LocalLibPath) {
+ push @tmp_inc, $_, @lib_dirs;
+ } else {
+ push @tmp_inc, $_;
}
- @INC = @tmp_inc;
}
+ @INC = @tmp_inc;
}
=head2 InitPlugins
More information about the Rt-commit
mailing list