#
#========================================================================
#
-# Version 2.0.0_CVS, released 18 Jan 2003.
+# Version 2.0.2, released 6 Oct 2003.
#
# See http://backuppc.sourceforge.net.
#
use BackupPC::Lib;
use BackupPC::Attrib qw(:all);
use BackupPC::FileZIO;
+use Data::Dumper;
sub new
{
my($m, $backupNum, $share, $dir) = @_;
my($i, $level);
+ #print STDERR "dirCache($backupNum, $share, $dir)\n";
$dir = "/$dir" if ( $dir !~ m{^/} );
$dir =~ s{/+$}{};
return if ( $m->{num} == $backupNum
#
$m->{mergeNums} = [];
for ( $i = $m->{idx} ; $level > 0 && $i >= 0 ; $i-- ) {
- #print("Do $i ($m->{backups}[$i]{noFill},$m->{backups}[$i]{level})\n");
+ #print(STDERR "Do $i ($m->{backups}[$i]{noFill},$m->{backups}[$i]{level})\n");
#
# skip backups with the same or higher level
#
$sharePathM = $share . $dir;
}
$path .= $sharePathM;
- #print("Opening $path\n");
+ #print(STDERR "Opening $path (share=$share)\n");
if ( !opendir(DIR, $path) ) {
if ( $i == $m->{idx} ) {
#
$file = $1 if ( $file =~ /(.*)/ );
my $fileUM = $file;
$fileUM = $m->{bpc}->fileNameUnmangle($fileUM) if ( $mangle );
+ #print(STDERR "Doing $fileUM\n");
#
# skip special files
#
next if ( $m->{files}{$file}{type} != BPC_FTYPE_DELETED );
delete($m->{files}{$file});
}
+ #print STDERR "Returning:\n", Dumper($m->{files});
}
#
sub fileAttrib
{
my($m, $backupNum, $share, $path) = @_;
- my $dir = $path;
- $dir =~ s{(.*)/(.*)}{$1};
- my $file = $2;
- $m->dirCache($backupNum, $share, $dir);
- return $m->{files}{$file};
+ if ( $path =~ s{(.*)/+(.+)}{$1} ) {
+ my $file = $2;
+ $m->dirCache($backupNum, $share, $path);
+ return $m->{files}{$file};
+ } else {
+ #print STDERR "Got empty $path\n";
+ $m->dirCache($backupNum, "", "");
+ my %attr = %{$m->{files}{$share}};
+ $attr{relPath} = "/";
+ return \%attr;
+ }
}
#
my $attr = $m->dirAttrib($backupNum, $share, $path);
return if ( !defined($attr) );
- foreach my $file ( keys(%$attr) ) {
+ foreach my $file ( sort(keys(%$attr)) ) {
&$callback($attr->{$file}, @callbackArgs);
next if ( !$depth || $attr->{$file}{type} != BPC_FTYPE_DIR );
#