X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FHelper.pm;h=86ba60f7e2de03a4effc222ace20d3561a2893a1;hb=d2985b9508b24b36c6800baa69214ed16817353b;hp=d201df856f6404e1ae2525394306c06f5eaefcd2;hpb=398d3347723a93bb7b09ad4e9775727f79bfa9d3;p=catagits%2FCatalyst-Devel.git diff --git a/lib/Catalyst/Helper.pm b/lib/Catalyst/Helper.pm index d201df8..86ba60f 100644 --- a/lib/Catalyst/Helper.pm +++ b/lib/Catalyst/Helper.pm @@ -34,19 +34,28 @@ Catalyst::Helper - Bootstrap a Catalyst application sub get_sharedir_file { my ($self, @filename) = @_; - my $dist_dir; + + my @try_dirs; + if (exists $self->{base}) { + push @try_dirs, $self->{base}; + } if (exists $ENV{CATALYST_DEVEL_SHAREDIR}) { - $dist_dir = $ENV{CATALYST_DEVEL_SHAREDIR}; + push @try_dirs, $ENV{CATALYST_DEVEL_SHAREDIR} } - elsif (-d "inc/.author" && -f "lib/Catalyst/Helper.pm" + if (-d "inc/.author" && -f "lib/Catalyst/Helper.pm" ) { # Can't use sharedir if we're in a checkout # this feels horrible, better ideas? - $dist_dir = 'share'; + push @try_dirs, 'share'; } else { - $dist_dir = dist_dir('Catalyst-Devel'); + push @try_dirs, dist_dir('Catalyst-Devel'); + } + + my $file; + foreach my $dist_dir (@try_dirs) { + $file = file( $dist_dir, @filename); + last if -r $file; } - my $file = file( $dist_dir, @filename); Carp::confess("Cannot find $file") unless -r $file; my $contents = $file->slurp; return $contents;