On Thu, 7 Mar 2002, Ben Reser wrote:

> 
> A better question is why are you doing all this work in a shell when
> you've already got a perl process running.  Seems so silly.

Because, plain and simple, I do not know _anything_ at all about perl.
Damien maintains that code and since he was kinda slow to fix it (and
a lot of people reported problems) I hacked at it myself. 

The stuff you did below looks like black magic to me, but I'm sure it 
would be a good idea if Damien could incorporate it (and eh..test it 
first).

Since you seem to understand perl, have a look at the rest of the code
when you have time. A lot of system calls are made, and I have an inkling
many of them are bound to cause errors.

Danny

> 
> use DirHandle; 
> my $drakfont_dir_handle = new DirHandle "$drakfont_dir_handle/tmp/tmp";
> if (defined $drakfont_dir_handle) {
>   my $curname;
>   while (defined($curname = $drakfont_dir_handle->read)) {
>     my $newname = $curname;
>     if ($curname !~ /\.ttf$/ && $curname !~ /\.ttf$/i) {
>       $newname =~ s/\.ttf$/\.ttf/i;
>       rename $curname, $newname || warn "Couldn't rename font $curname to
> $newname: $!";
>     }
>   }
>   undef $drakfont_dir_handle;
> } else {
>   warn "Unable open directory handle to be able to find fonts that need
> renaming\n";
> }
> 
> While I didn't test this in drakfont I did test it in a quick and dirty
> standalone script.  And DirHandle is included in the standard perl
> package. :)
> 
> I know it's longer but it handles any case combination of .ttf cleanly.
> 
> 


Reply via email to