[Po4a-devel][CVS] po4a/lib/Locale/Po4a Po.pm,1.21,1.22 TransTractor.pm,1.31,1.32
Martin Quinson
po4a-devel@lists.alioth.debian.org
Sun, 08 Aug 2004 19:58:50 +0000
Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv6758
Modified Files:
Po.pm TransTractor.pm
Log Message:
Do not create the path to file when no path specified (ie, file local) since the method fails miserably in that case
Index: Po.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Po.pm,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- Po.pm 8 Aug 2004 11:31:07 -0000 1.21
+++ Po.pm 8 Aug 2004 19:58:48 -0000 1.22
@@ -224,11 +224,12 @@
} else {
# make sure the directory in which we should write the localized file exists
my $dir = $filename;
- $dir =~ s|/[^/]*$||;
+ if ($dir =~ m|/|) {
+ $dir =~ s|/[^/]*$||;
- File::Path::mkpath($dir, 0, 0755) # Croaks on error
- if (length ($dir) && ! -e $dir);
-
+ File::Path::mkpath($dir, 0, 0755) # Croaks on error
+ if (length ($dir) && ! -e $dir);
+ }
open $fh,">$filename"
|| croak (sprintf((dgettext("po4a","Can't write to %s: %s"),$filename,$!))."\n");
}
Index: TransTractor.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/TransTractor.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- TransTractor.pm 7 Aug 2004 23:59:02 -0000 1.31
+++ TransTractor.pm 8 Aug 2004 19:58:48 -0000 1.32
@@ -381,11 +381,12 @@
} else {
# make sure the directory in which we should write the localized file exists
my $dir = $filename;
- $dir =~ s|/[^/]*$||;
+ if ($dir =~ m|/|) {
+ $dir =~ s|/[^/]*$||;
- File::Path::mkpath($dir, 0, 0755) # Croaks on error
- if (length ($dir) && ! -e $dir);
-
+ File::Path::mkpath($dir, 0, 0755) # Croaks on error
+ if (length ($dir) && ! -e $dir);
+ }
open $fh,">$filename"
|| croak (sprintf((dgettext("po4a","can't write to %s: %s"),$filename,$!))."\n");
}