systemactions.pm (852d2129) | systemactions.pm (9f91b7e3) |
---|---|
1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance --- 1696 unchanged lines hidden (view full) --- 1705 } 1706} 1707 1708############################################################## 1709# Reading all files from a directory and its subdirectories 1710# Version 2 1711############################################################## 1712 | 1#************************************************************** 2# 3# Licensed to the Apache Software Foundation (ASF) under one 4# or more contributor license agreements. See the NOTICE file 5# distributed with this work for additional information 6# regarding copyright ownership. The ASF licenses this file 7# to you under the Apache License, Version 2.0 (the 8# "License"); you may not use this file except in compliance --- 1696 unchanged lines hidden (view full) --- 1705 } 1706} 1707 1708############################################################## 1709# Reading all files from a directory and its subdirectories 1710# Version 2 1711############################################################## 1712 |
1713sub read_full_directory { | 1713sub read_full_directory ($$$) 1714{ |
1714 my ( $currentdir, $pathstring, $collector ) = @_; 1715 my $item; 1716 my $fullname; 1717 local *DH; 1718 | 1715 my ( $currentdir, $pathstring, $collector ) = @_; 1716 my $item; 1717 my $fullname; 1718 local *DH; 1719 |
1719 unless (opendir(DH, $currentdir)) 1720 { 1721 return; 1722 } 1723 while (defined ($item = readdir(DH))) 1724 { 1725 next if($item eq "." or $item eq ".."); 1726 $fullname = $currentdir . $installer::globals::separator . $item; 1727 my $sep = ""; 1728 if ( $pathstring ne "" ) { $sep = $installer::globals::separator; } | 1720 $installer::logger::Lang->printf("seaching files under '%s'\n", $currentdir); |
1729 | 1721 |
1730 if( -d $fullname) 1731 { 1732 my $newpathstring = $pathstring . $sep . $item; 1733 read_full_directory($fullname, $newpathstring, $collector) if(-d $fullname); 1734 } 1735 else 1736 { 1737 my $content = $pathstring . $sep . $item; 1738 push(@{$collector}, $content); 1739 } 1740 } 1741 closedir(DH); 1742 return | 1722 my @directory_queue = [$currentdir, $pathstring]; 1723 1724 while (scalar @directory_queue > 0) 1725 { 1726 my ($path, $relative_path) = @{shift @directory_queue}; 1727 my $start_count = scalar @$collector; 1728 1729 next unless opendir(DH, $path); 1730 1731 while (defined ($item = readdir(DH))) 1732 { 1733 next if($item eq "." or $item eq ".."); 1734 $fullname = $path . $installer::globals::separator . $item; 1735 my $sep = ""; 1736 if ($relative_path ne "") 1737 { 1738 $sep = $installer::globals::separator; 1739 } 1740 1741 if( -d $fullname) 1742 { 1743 push @directory_queue, [$fullname, $relative_path . $sep . $item]; 1744 } 1745 else 1746 { 1747 my $content = $relative_path . $sep . $item; 1748 push(@{$collector}, $content); 1749 } 1750 } 1751 closedir(DH); 1752 my $count = scalar @$collector - $start_count; 1753 $installer::logger::Lang->printf(" found %d new files in '%s'\n", $count, $path); 1754 } |
1743} 1744 1745############################################################## 1746# Removing all empty directories below a specified directory 1747############################################################## 1748 1749sub remove_empty_dirs_in_folder 1750{ --- 42 unchanged lines hidden --- | 1755} 1756 1757############################################################## 1758# Removing all empty directories below a specified directory 1759############################################################## 1760 1761sub remove_empty_dirs_in_folder 1762{ --- 42 unchanged lines hidden --- |