Permalink
Browse files

Silly path construction bugs

  • Loading branch information...
seveas committed Jan 23, 2012
1 parent f48b8f7 commit 231d5f6c220280102e879ef2be93394c3524dd79
Showing with 5 additions and 6 deletions.
  1. +4 −5 lib/CPAN/Unpack.pm
  2. +1 −1 t/local.t
View
@@ -76,17 +76,16 @@ sub unpack {
}
if ( defined($unpacked)
- && $unpacked eq $unpacked_versions{ $distribution->dist } )
+ && $unpacked eq $unpacked_versions{ $distribution->dist }
+ && -d $want )
{
- print "Skipping " . $distribution->prefix . " ($counter)\n"
- unless $self->quiet;
next;
}
if ( -d $want ) {
print "Deleting old version of " . $distribution->dist . "\n"
unless $self->quiet;
- rmtree "$destination/$want";
+ rmtree $want;
}
print "Unpacking " . $distribution->prefix . " ($counter)\n"
@@ -106,7 +105,7 @@ sub unpack {
my $files = @files;
if ( $files == 1 ) {
my $file = $files[0];
- if ( S_ISDIR( stat($file) ) ) {
+ if ( S_ISDIR( stat("$to/$file") ) ) {
rename $file, $want;
} else {
mkdir $want;
View
@@ -17,5 +17,5 @@ ok( -d "t/unpacked/Acme-Buffy" );
ok( -d "t/unpacked/Acme-Colour" );
ok( -d "t/unpacked/GraphViz" );
-my @files = <t/unpacked/GraphViz/GraphViz-1.8/*>;
+my @files = <t/unpacked/GraphViz/*>;
is( scalar(@files), 7 );

0 comments on commit 231d5f6

Please sign in to comment.