diff options
| author | Arne Georg Gleditsch <argggh@lxr.linpro.no> | 2007-12-04 16:21:33 +0100 | 
|---|---|---|
| committer | Arne Georg Gleditsch <argggh@lxr.linpro.no> | 2007-12-04 16:21:33 +0100 | 
| commit | e5ab9bf906f39f1cb1f5e93eff42aaaba5dd3a3e (patch) | |
| tree | 0dc4a89bf1fb349e6f53e148785a463951a950eb | |
| parent | 42321d209faa0ba4c93d2523f8644575ea094bba (diff) | |
Let root be named / instead of empty string.
| -rw-r--r-- | lib/LXRng/Repo/Plain/Directory.pm | 6 | 
1 files 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;      }  | 
