[otrs-cvs] CVS: module-tools link.pl,1.6,1.7

cvs-log at otrs.org cvs-log at otrs.org
Tue Aug 1 23:41:19 CEST 2006


Update of /home/cvs/module-tools
In directory lancelot:/tmp/cvs-serv13811

Modified Files:
	link.pl 
Log Message:
added auto creation for directories

Index: link.pl
===================================================================
RCS file: /home/cvs/module-tools/link.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** link.pl	21 Jan 2005 13:01:42 -0000	1.6
--- link.pl	1 Aug 2006 20:41:17 -0000	1.7
***************
*** 34,37 ****
--- 34,54 ----
  #            my $Dir =~ s/^(.*)\//$1/;
              if ($File !~ /Entries|Repository|Root|CVS/) {
+                 # check directory of loaction (in case create a directory)
+                 if ("$Dest/$File" =~ /^(.*)\/(.+?|)$/) {
+                     my $Directory = $1;
+                     my @Directories = split(/\//, $Directory);
+                     my $DirectoryCurrent = '';
+                     foreach my $Directory (@Directories) {
+                         $DirectoryCurrent .= "/$Directory";
+                         if ($DirectoryCurrent && ! -d $DirectoryCurrent) {
+                             if (mkdir $DirectoryCurrent) {
+                                 print STDERR "NOTICE: Create Directory $DirectoryCurrent\n";
+                             }
+                             else {
+                                 die "ERROR: can't create directory $DirectoryCurrent: $!";
+                             }
+                         }
+                     }
+                 }
  #            if (!-e"$Dest/$File" || (-l "$Dest/$File" && unlink ("$Dest/$File"))) {
                  if (-l "$Dest/$File") {



More information about the cvs-log mailing list