Should detect if we're in a checkout. I'm still not happy with this
[catagits/Catalyst-Devel.git] / lib / Catalyst / Helper.pm
index 05fdd46..c2ef31d 100644 (file)
@@ -32,8 +32,15 @@ Catalyst::Helper - Bootstrap a Catalyst application
 
 sub get_sharedir_file {
     my ($self, @filename) = @_;
-    my $file = file( dist_dir('Catalyst-Devel'), @filename);
-    warn $file;
+    my $dist_dir;
+    if (-d "inc/.author") { # Can't use sharedir if we're in a checkout
+                            # this feels horrible, better ideas?
+        $dist_dir = 'share';
+    }
+    else {
+        $dist_dir = dist_dir('Catalyst-Devel');
+    }
+    my $file = file( $dist_dir, @filename);
     my $contents = $file->slurp;
     return $contents;
 }
@@ -437,7 +444,7 @@ sub _mk_images {
       btn_120x50_powered btn_120x50_powered_shadow btn_88x31_built
       btn_88x31_built_shadow btn_88x31_powered btn_88x31_powered_shadow/;
     for my $name (@images) {
-        my $image = $self->get_file("$name.png");
+        my $image = $self->get_sharedir_file("root", "$name.png");
         $self->mk_file( File::Spec->catfile( $images, "$name.png" ), $image );
     }
 }