From ed61b382bc12f15df4bb5306efb7980e7dc293aa Mon Sep 17 00:00:00 2001 From: Rob Kendrick Date: Fri, 15 Jun 2007 22:03:19 +0000 Subject: Pre-seed mime type hash with essentials for use on OSes with useless /etc/mime.types files svn path=/trunk/netsurf/; revision=3349 --- gtk/gtk_filetype.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/gtk/gtk_filetype.c b/gtk/gtk_filetype.c index f34aa0bcd..290065cc4 100644 --- a/gtk/gtk_filetype.c +++ b/gtk/gtk_filetype.c @@ -39,15 +39,21 @@ void gtk_fetch_filetype_init(const char *mimefile) fh = fopen(mimefile, "r"); + /* Some OSes (mentioning no Solarises) have a worthlessly tiny + * /etc/mime.types that don't include essential things, so we + * pre-seed our hash with the essentials. These will get + * over-ridden if they are mentioned in the mime.types file. + */ + + hash_add(mime_hash, "css", "text/css"); + hash_add(mime_hash, "jpg", "image/jpeg"); + hash_add(mime_hash, "jpeg", "image/jpeg"); + hash_add(mime_hash, "gif", "image/gif"); + hash_add(mime_hash, "png", "image/png"); + hash_add(mime_hash, "jng", "image/jng"); + if (fh == NULL) { - LOG(("Unable to open a mime.types file, so building a minimal one for you.")); - hash_add(mime_hash, "css", "text/css"); - hash_add(mime_hash, "jpg", "image/jpeg"); - hash_add(mime_hash, "jpeg", "image/jpeg"); - hash_add(mime_hash, "gif", "image/gif"); - hash_add(mime_hash, "png", "image/png"); - hash_add(mime_hash, "jng", "image/jng"); - + LOG(("Unable to open a mime.types file, so using a minimal one for you.")); return; } -- cgit v1.2.3