From e5ab9bf906f39f1cb1f5e93eff42aaaba5dd3a3e Mon Sep 17 00:00:00 2001 From: Arne Georg Gleditsch Date: Tue, 4 Dec 2007 16:21:33 +0100 Subject: Let root be named / instead of empty string. --- lib/LXRng/Repo/Plain/Directory.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/LXRng/Repo/Plain/Directory.pm b/lib/LXRng/Repo/Plain/Directory.pm index 6025142..2cdddbc 100644 --- a/lib/LXRng/Repo/Plain/Directory.pm +++ b/lib/LXRng/Repo/Plain/Directory.pm @@ -7,7 +7,7 @@ use base qw(LXRng::Repo::Directory); sub new { my ($class, $name, $path, $stat) = @_; - $name =~ s,(.)/*$,$1/,; + $name =~ s,/*$,/,; $path =~ s,/*$,/,; return bless({name => $name, path => $path, stat => $stat}, $class); } @@ -35,12 +35,14 @@ sub contents { my (@dirs, @files); my ($dir, $node); + my $prefix = $$self{'name'}; + $prefix =~ s,^/+,,; opendir($dir, $$self{'path'}) or die("Can't open ".$$self{'path'}.": $!"); while (defined($node = readdir($dir))) { next if $node =~ /^\.|~$|\.orig$/; next if $node eq 'CVS'; - my $file = LXRng::Repo::Plain::File->new($$self{'name'}.$node, + my $file = LXRng::Repo::Plain::File->new($prefix.$node, $$self{'path'}.$node); push(@files, $file) if $file; } -- cgit v1.2.3