From a2fa99de9b89b81721c30e133837d102e40020d5 Mon Sep 17 00:00:00 2001
From: Norbert Preining <preining@logic.at>
Date: Thu, 13 Nov 2008 12:57:53 +0000
Subject: try to work around fc-cache problems on w32

git-svn-id: svn://tug.org/texlive/trunk@11286 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/tlpkg/TeXLive/TLPostActions.pm | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

(limited to 'Master')

diff --git a/Master/tlpkg/TeXLive/TLPostActions.pm b/Master/tlpkg/TeXLive/TLPostActions.pm
index e91a468f457..b433437b258 100644
--- a/Master/tlpkg/TeXLive/TLPostActions.pm
+++ b/Master/tlpkg/TeXLive/TLPostActions.pm
@@ -17,7 +17,8 @@ BEGIN {
   @EXPORT = @EXPORT_OK;
 }
 
-use TeXLive::TLUtils qw(win32 mkdirhier copy conv_to_w32_path log debug info);
+use TeXLive::TLUtils qw(win32 mkdirhier copy conv_to_w32_path log debug info
+                        touch);
 use TeXLive::TLWinGoo;
 
 my $mainmenu = "TeX Live 2008";
@@ -74,7 +75,7 @@ sub do_install_xetex {
     chomp($texmfsysvar);
   }
   if (-r "$texdir/bin/win32/conf/fonts.conf") {
-    # we have installed win32, so put it into texmfsysvar
+    # we have installed w32, so put it into texmfsysvar
     mkdirhier("$texmfsysvar/fonts");
     TeXLive::TLUtils::rmtree("$texmfsysvar/fonts/conf");
     TeXLive::TLUtils::rmtree("$texmfsysvar/fonts/cache");
@@ -103,6 +104,21 @@ sub do_install_xetex {
           $winfontdir = $ENV{'SystemRoot'}.'/fonts';
           $winfontdir =~ s!\\!/!g;
           #mkdirhier("$texmfsysvar/fonts/cache");
+
+          # fc-cache breaks often on w32 in some strange way
+          # there are claims that touching a font file in $winfontdir
+          # would solve that problem. So lets touch some of them
+          if (opendir (WINFONT, $winfontdir)) {
+            my @dirents = readdir (WINFONT);
+            closedir (WINFONT) || warn "closedir($winfontdir) failed: $!";
+            for my $dirent (@dirents) {
+              if ($dirent =~ m/\.(ttf|otf)$/i) {
+                touch($dirent);
+                # one file touched should be enough
+                last;
+              }
+            }
+          }
         }
         foreach (@lines) {
           $_ =~ s!c:/Program Files/texlive/2008!$texdir!;
@@ -120,7 +136,7 @@ sub do_install_xetex {
       warn("Cannot open $texdir/bin/win32/conf/fonts.conf\n");
     }
   }
-  # call fc-cache but only when we install on win32!
+  # call fc-cache but only when we install on w32!
   if (win32()) {
     info("Running fc-cache -v -r\n");
     log(`fc-cache -v -r 2>&1`);
-- 
cgit v1.2.3