From: John Graham-C. <jgr...@us...> - 2006-03-06 12:51:43
|
Update of /cvsroot/popfile/engine/POPFile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31899 Modified Files: History.pm Log Message: Modify the code that cleans up empty directories so that it doesn't do globbing (it relies on the return code of rmdir instead). Thanks to olivier_myriad for the idea Index: History.pm =================================================================== RCS file: /cvsroot/popfile/engine/POPFile/History.pm,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** History.pm 20 Feb 2006 02:01:57 -0000 1.40 --- History.pm 6 Mar 2006 12:51:36 -0000 1.41 *************** *** 301,324 **** unlink $file; ! # It's not possible that the directory for the slot file is empty ! # and we want to delete it so that things get cleaned up automatically ! $file =~ s/popfile[a-f0-9]{2}\.msg$//i; my $depth = 3; while ( $depth > 0 ) { ! my @files = glob( $file . '*' ); ! ! if ( $#files == -1 ) { ! if ( !( rmdir( $file ) ) ) { ! last; ! } ! $file =~ s![a-f0-9]{2}/$!!i; ! } else { ! last; } - - $depth--; } } --- 301,318 ---- unlink $file; ! # It's now possible that the directory for the slot file is empty ! # and we want to delete it so that things get cleaned up ! # automatically ! my $directory = $file; ! $directory =~ s/popfile[a-f0-9]{2}\.msg$//i; my $depth = 3; while ( $depth > 0 ) { ! if ( rmdir( $directory ) ) { ! $directory =~ s![a-f0-9]{2}/$!!i; ! $depth--; } } } |