ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Utilities/AddDir.pm
(Generate patch)

Comparing COMP/SCRAM/src/Utilities/AddDir.pm (file contents):
Revision 1.11 by sashby, Wed Aug 17 11:11:48 2005 UTC vs.
Revision 1.14.2.1 by muzaffar, Tue Feb 19 11:03:39 2008 UTC

# Line 14 | Line 14 | Utilities::AddDir - Utility functions fo
14  
15   =cut
16  
17 < package AddDir;
17 > package Utilities::AddDir;
18   require 5.001;
19   require Exporter;
20   use Cwd;
# Line 82 | Line 82 | sub copydir
82           else
83              {
84              copy($src."/".$file,$dest."/".$file);
85 <            if ( -x $src."/".$file || -X $src."/".$file ) {chmod(0775,$dest."/".$file);}
85 >            if ( -x $src."/".$file || -X $src."/".$file ) {chmod(0755,$dest."/".$file);}
86              }
87           }
88        undef $dh;
89        }
90     else
91        {
92 <      die "Attempt to open a non-existent directory ($src). Exitting\n";
92 >      die "Attempt to open a non-existent directory ($src). Exiting\n";
93        }
94     }
95  
# Line 104 | Line 104 | sub copydirwithskip
104     {
105     my $src=shift;
106     my $dest=shift;
107 <   my ($filetoskip)=@_;
107 >   my $filetoskip=shift || [];
108    
109     use DirHandle;
110     use File::Copy;
# Line 122 | Line 122 | sub copydirwithskip
122           {
123           next if $file=~/^\.\.?/;
124           # Skip backup files and x~ files:
125 <         next if $file =~ /.*bak$/;
125 >         next if $file =~ /.*\.bak$/;
126           next if $file =~ /.*~$/;
127  
128 <         if ($file eq $filetoskip)
128 >         my $skip=0;
129 >         foreach my $fskip (@$filetoskip)
130 >            {
131 >            my $fullfile = "${src}/${file}";
132 >            if ($fullfile eq $fskip)
133 >               {
134 >               $skip = 1;
135 >               last;
136 >               }
137 >            }
138 >         if ($skip)
139              {
140              next;
141              }
142          
143           if ( -d $src."/".$file )
144              {
145 <            copydir($src."/".$file,$dest."/".$file);
145 >            copydirwithskip($src."/".$file,$dest."/".$file,$filetoskip);
146              }
147           else
148              {
149              copy($src."/".$file,$dest."/".$file);
150 <            if ( -x $src."/".$file || -X $src."/".$file ) {chmod(0775,$dest."/".$file);}
150 >            if ( -x $src."/".$file || -X $src."/".$file ) {chmod(0755,$dest."/".$file);}
151              }
152           }
153        undef $dh;
154        }
155     else
156        {
157 <      die "Attempt to open a non-existent directory ($src). Exitting\n";
157 >      die "Attempt to open a non-existent directory ($src). Exiting\n";
158        }
159     }
160  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines