diff options
author | Thierry Vignaud <tv@mandriva.org> | 2007-06-08 00:08:11 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2007-06-08 00:08:11 +0000 |
commit | c81c7e905391e0c313fe2b89b8b42f5377122608 (patch) | |
tree | 41b777f2f2748cfa5147a76bf6bf660f4ad043ec | |
parent | f9dcc0606f123dc3f29d0662060f2d2736037994 (diff) | |
download | drakx-c81c7e905391e0c313fe2b89b8b42f5377122608.tar drakx-c81c7e905391e0c313fe2b89b8b42f5377122608.tar.gz drakx-c81c7e905391e0c313fe2b89b8b42f5377122608.tar.bz2 drakx-c81c7e905391e0c313fe2b89b8b42f5377122608.tar.xz drakx-c81c7e905391e0c313fe2b89b8b42f5377122608.zip |
(search_windows_font) simplify finding windows fonts & make it now really case insensitive
-rw-r--r-- | perl-install/NEWS | 2 | ||||
-rwxr-xr-x | perl-install/standalone/drakfont | 28 |
2 files changed, 16 insertions, 14 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index aa38252ef..5fd44fb89 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -3,6 +3,8 @@ - drakfont: o do not misbelieve a font is already installed if substring of another font name + o simplify finding windows fonts + o finding windows fonts is now really case insensitive Version 10.4.134 - 06 June 2007, by Thierry Vignaud diff --git a/perl-install/standalone/drakfont b/perl-install/standalone/drakfont index 8fa77617e..97af4f1a4 100755 --- a/perl-install/standalone/drakfont +++ b/perl-install/standalone/drakfont @@ -199,14 +199,17 @@ sub search_installed_fonts_full_path() { } sub search_windows_font() { + my @fonts; foreach my $fstab_line (grep { /vfat|smbfs|ntfs|fuse/ } cat_('/etc/mtab')) { my $win_dir = (split('\s', $fstab_line))[1]; - my @list_fonts_win = (all("$win_dir/windows/fonts"), all("$win_dir/WINDOWS/Fonts")); - my @list_fonts_winnt = all("$win_dir/winnt/fonts"); - my $nb_dir = @list_fonts_win + @list_fonts_winnt; - foreach ([ \@list_fonts_win, "windows" ], - [ \@list_fonts_win, "WINDOWS" ], - [ \@list_fonts_winnt, "winnt" ]) { + foreach my $sys_dir (grep { /^win(nt|dows)$/i } all($win_dir)) { + foreach my $font_dir (grep { /^fonts$/i } map { all($_) } "$win_dir/$sys_dir") { + push @fonts, map { "$win_dir/$sys_dir/$font_dir/$_" } all("$win_dir/$sys_dir/$font_dir"); + } + } + } + my $nb_dir = @fonts; + foreach my $font (@fonts) { foreach my $i (@{ $_->[0] }) { if ($interactive) { if ($nb_dir) { @@ -216,15 +219,12 @@ sub search_windows_font() { return 0; } } - !$replace && any { /^$i$/ } @installed_fonts and next; - my $subdir = $_->[1]; - any { /^$i$/ } @font_list or push @font_list, - grep { -e $_ } map { ("$win_dir/$subdir/fonts/$_", - "$win_dir/$subdir/Fonts/$_") } $i; - } - } - $interactive && $nb_dir and progress($pbar, 1, N("done")); + + my $font_name = basename($font); + !$replace && any { /^$font_name$/ } @installed_fonts and next; + any { /^$font_name$/ } @font_list or push @font_list, $font; } + $interactive && $nb_dir and progress($pbar, 1, N("done")); if (!@font_list) { print "[35mdrakfont:: could not find any font in /win*/fonts [0m\n"; $interactive |