From 0c35c0facb1f05a21f702636a291eb6ee3dea3a2 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 19 Jun 2002 20:55:19 +0000 Subject: [PATCH] Make fc-cache more tolerant of missing font directories --- fc-cache/fc-cache.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c index b3d0f3f..ed920fd 100644 --- a/fc-cache/fc-cache.c +++ b/fc-cache/fc-cache.c @@ -1,5 +1,5 @@ /* - * $XFree86: xc/lib/fontconfig/fc-cache/fc-cache.c,v 1.2 2002/02/15 07:36:14 keithp Exp $ + * $XFree86: xc/lib/fontconfig/fc-cache/fc-cache.c,v 1.4 2002/05/21 17:06:21 keithp Exp $ * * Copyright © 2002 Keith Packard, member of The XFree86 Project, Inc. * @@ -25,6 +25,9 @@ #include #include #include +#include +#include +#include #ifdef HAVE_CONFIG_H #include #else @@ -97,6 +100,7 @@ scanDirs (FcStrList *list, char *program, FcBool force, FcBool verbose) FcFontSet *set; FcStrSet *subdirs; FcStrList *sublist; + struct stat statb; /* * Now scan all of the directories into separate databases @@ -123,9 +127,29 @@ scanDirs (FcStrList *list, char *program, FcBool force, FcBool verbose) ret++; continue; } + + if (stat ((char *) dir, &statb) == -1) + { + if (errno == ENOENT || errno == ENOTDIR) + { + fprintf (stderr, "\"%s\": no such directory, skipping\n", dir); + } + else + { + fprintf (stderr, "\"%s\": ", dir); + perror (""); + ret++; + } + continue; + } + if (!S_ISDIR (statb.st_mode)) + { + fprintf (stderr, "\"%s\": not a directory, skipping\n", dir); + continue; + } if (!FcDirScan (set, subdirs, 0, FcConfigGetBlanks (0), dir, force)) { - fprintf (stderr, "Can't scan \"%s\"\n", dir); + fprintf (stderr, "\"%s\": error scanning\n", dir); ret++; continue; } -- 2.39.5