gtkhtml r8814 - trunk/components/editor



Author: mbarnes
Date: Mon Apr  7 17:06:47 2008
New Revision: 8814
URL: http://svn.gnome.org/viewvc/gtkhtml?rev=8814&view=rev

Log:
2008-04-07  Matthew Barnes  <mbarnes redhat com>

	** Fixes bug #525996

	* gtkhtml-editor-private.c (gtkhtml_editor_find_data_file):
	If we can't find a required data file, emit a helpful message about
	XDG_DATA_DIRS, show where we looked, and then abort immediately.



Modified:
   trunk/components/editor/ChangeLog
   trunk/components/editor/gtkhtml-editor-private.c

Modified: trunk/components/editor/gtkhtml-editor-private.c
==============================================================================
--- trunk/components/editor/gtkhtml-editor-private.c	(original)
+++ trunk/components/editor/gtkhtml-editor-private.c	Mon Apr  7 17:06:47 2008
@@ -20,6 +20,8 @@
 
 #include "gtkhtml-editor-private.h"
 
+#include <stdlib.h>
+
 #include <glade/glade.h>
 #include <glade/glade-build.h>
 
@@ -28,6 +30,17 @@
 #define SEP	"\\x09\\x20\\(\\)<>@,;:\\\\\"/\\[\\]\\?=\\{\\}"
 #define TOKEN	"[^" CTL SEP "]+"
 
+/* Fatal error message given when a data file is not found. */
+#define DATA_FILE_NOT_FOUND_MESSAGE \
+"\n*** FATAL ERROR ***\n\n" \
+PACKAGE " could not find the required file \"%s\" in any of\n" \
+"the system-wide data directories given by the XDG_DATA_DIRS environment\n" \
+"variable.  " PACKAGE " looked for:\n\n"
+
+#define MORE_INFORMATION_MESSAGE \
+"\nSee http://www.freedesktop.org/Standards/basedir-spec for more\n" \
+"information about standard base directories.\n\n"
+
 /************************ Begin Spell Dialog Callbacks ***********************/
 
 static void
@@ -399,9 +412,19 @@
 		g_free (filename);
 	}
 
-	g_critical ("Could not locate '%s'", basename);
+	/* Print a helpful message and die. */
+	g_printerr (DATA_FILE_NOT_FOUND_MESSAGE, basename);
+	datadirs = g_get_system_data_dirs ();
+	while (*datadirs != NULL) {
+		filename = g_build_filename (
+			*datadirs++, GTKHTML_RELEASE_STRING, basename, NULL);
+		g_printerr ("\t%s\n", filename);
+		g_free (filename);
+	}
+	g_printerr (MORE_INFORMATION_MESSAGE);
+	abort ();
 
-	return NULL;
+	return NULL;  /* never gets here */
 }
 
 gchar *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]