[Jifty-commit] r6773 - jifty/trunk/lib/Jifty
Jifty commits
jifty-commit at lists.jifty.org
Tue Apr 14 18:18:53 EDT 2009
Author: alexmv
Date: Tue Apr 14 18:18:52 2009
New Revision: 6773
Modified:
jifty/trunk/lib/Jifty/Plugin.pm
Log:
Fixes for plugin share paths when running Jifty out of @INC
Modified: jifty/trunk/lib/Jifty/Plugin.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin.pm Tue Apr 14 18:18:52 2009
@@ -112,11 +112,21 @@
my $class = ref($self);
unless ( $self->{share} and -d $self->{share} ) {
+ # If we've got a Jifty in @INC, and the plugin is core, the
+ # right thing to do is to strip off lib/ and replace it with
+ # share/plugins/Jifty/Plugin/Whatever/
+ my $class_to_path = $class;
+ $class_to_path =~ s|::|/|g;
- # If we've got a plugin distribution in @INC as well as an
- # installed version, then File::Sharedir will find the
- # installed version. So, we first try to tear off everything
- # after the lib/ and replace it with share/
+ $self->{share} = $INC{ $class_to_path . '.pm' };
+ $self->{share} =~ s{lib/+\Q$class_to_path.pm}{share/plugins/$class_to_path};
+ $self->{share} = File::Spec->rel2abs( $self->{share} );
+ }
+ unless ( $self->{share} and -d $self->{share} ) {
+ # As above, but only tack on share/, for when we have a
+ # non-core plugin in @INC. We do this before the
+ # File::ShareDir, because File::ShareDir only looks at install
+ # locations, and the plugin could be hand-set in @INC.
my $class_to_path = $class;
$class_to_path =~ s|::|/|g;
More information about the Jifty-commit
mailing list