koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/misc/translator tmpl_process3.pl,1.20.2.1,1.20.2.2


From: Ambrose C. LI
Subject: [Koha-cvs] CVS: koha/misc/translator tmpl_process3.pl,1.20.2.1,1.20.2.2
Date: Thu, 03 Feb 2005 19:48:55 -0800

Update of /cvsroot/koha/koha/misc/translator
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16119

Modified Files:
      Tag: rel_2_2
        tmpl_process3.pl 
Log Message:
Script failed to create intermediate directories if the directory of the
target does not exist and the parent of that directory does not exist
either. This should fix that.


Index: tmpl_process3.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/tmpl_process3.pl,v
retrieving revision 1.20.2.1
retrieving revision 1.20.2.2
diff -C2 -r1.20.2.1 -r1.20.2.2
*** tmpl_process3.pl    23 Jan 2005 10:51:16 -0000      1.20.2.1
--- tmpl_process3.pl    4 Feb 2005 03:48:53 -0000       1.20.2.2
***************
*** 139,142 ****
--- 139,157 ----
  
###############################################################################
  
+ sub mkdir_recursive ($) {
+     my($dir) = @_;
+     local($`, $&, $', $1);
+     $dir = $` if $dir ne /^\/+$/ && $dir =~ /\/+$/;
+     my ($prefix, $basename) = ($dir =~ /\/([^\/]+)$/s)? ($`, $1): ('.', $dir);
+     mkdir_recursive($prefix) if $prefix ne '.' && !-d $prefix;
+     if (!-d $dir) {
+       print STDERR "Making directory $dir...";
+       # creates with rwxrwxr-x permissions
+       mkdir($dir, 0775) || warn_normal "$dir: $!", undef;
+     }
+ }
+ 
+ 
###############################################################################
+ 
  sub usage ($) {
      my($exitcode) = @_;
***************
*** 354,362 ****
        my $target = $out_dir . substr($input, length($in_dir));
        my $targetdir = $` if $target =~ /[^\/]+$/s;
!       if (!-d $targetdir) {
!           print STDERR "Making directory $targetdir...";
!           # creates with rwxrwxr-x permissions
!           mkdir($targetdir, 0775) || warn_normal "$targetdir: $!", undef;
!       }
        print STDERR "Creating $target...\n";
        open( OUTPUT, ">$target" ) || die "$target: $!\n";
--- 369,373 ----
        my $target = $out_dir . substr($input, length($in_dir));
        my $targetdir = $` if $target =~ /[^\/]+$/s;
!       mkdir_recursive($targetdir) unless -d $targetdir;
        print STDERR "Creating $target...\n";
        open( OUTPUT, ">$target" ) || die "$target: $!\n";




reply via email to

[Prev in Thread] Current Thread [Next in Thread]