diff --git a/src/gnome-utils/dialog-utils.c b/src/gnome-utils/dialog-utils.c index 045d89db6d..725fb4d8ce 100644 --- a/src/gnome-utils/dialog-utils.c +++ b/src/gnome-utils/dialog-utils.c @@ -820,9 +820,22 @@ gnc_glade_xml_new (const char *filename, const char *root) } gnc_glade_dir = gnc_path_get_gladedir (); + if (!g_file_test(gnc_glade_dir, G_FILE_TEST_IS_DIR)) + { + g_critical("Directory for glade UI files \"%s\" is not found. Your installation is incomplete and cannot be run.", gnc_glade_dir); + g_free (gnc_glade_dir); + return NULL; + } + fname = g_build_filename(gnc_glade_dir, filename, (char *)NULL); g_free (gnc_glade_dir); + if (!g_file_test(fname, G_FILE_TEST_EXISTS)) + { + g_critical("The glade UI file \"%s\" is not found. Your installation is incomplete and cannot be run.", fname); + return NULL; + } + xml = glade_xml_new (fname, root, NULL); g_free (fname); diff --git a/src/gnome-utils/druid-gconf-setup.c b/src/gnome-utils/druid-gconf-setup.c index e70e5ae50c..77063e8f63 100644 --- a/src/gnome-utils/druid-gconf-setup.c +++ b/src/gnome-utils/druid-gconf-setup.c @@ -676,7 +676,14 @@ druid_gconf_install_check_schemas (void) #endif /* G_OS_WIN32 */ xml = gnc_glade_xml_new ("druid-gconf-setup.glade", "GConf Query"); + if (!xml) + { + gnc_error_dialog(NULL, "The glade UI files were not found. Your installation is incomplete and cannot be run."); + exit(-1); /* quit immediately */ + } + g_assert(xml); dialog = glade_xml_get_widget (xml, "GConf Query"); + g_assert(dialog); do { response = gtk_dialog_run(GTK_DIALOG(dialog)); diff --git a/src/gnome-utils/gnc-gnome-utils.c b/src/gnome-utils/gnc-gnome-utils.c index fa9aeb6b0f..53da66cdeb 100644 --- a/src/gnome-utils/gnc-gnome-utils.c +++ b/src/gnome-utils/gnc-gnome-utils.c @@ -260,6 +260,25 @@ gnc_gnome_init (int argc, char **argv, const char * version) gchar *pkgsysconfdir = gnc_path_get_pkgsysconfdir (); gchar *pkgdatadir = gnc_path_get_pkgdatadir (); gchar *pkglibdir = gnc_path_get_pkglibdir (); + gboolean installation_ok = TRUE; + + /* Verify all the various directory before proceeding */ + if (!g_file_test(pkgdatadir, G_FILE_TEST_IS_DIR)) + { + g_critical("The installation data directory \"%s\" was not found. Your installation is incomplete and cannot be run.", pkgdatadir); + installation_ok = FALSE; + } + if (!g_file_test(pkglibdir, G_FILE_TEST_IS_DIR)) + { + g_critical("The installation lib directory \"%s\" was not found. Your installation is incomplete and cannot be run.", pkglibdir); + installation_ok = FALSE; + } + + if (!g_file_test(pkgsysconfdir, G_FILE_TEST_IS_DIR)) + { + g_critical("The installation sysconf directory \"%s\" was not found. Your installation is incomplete and cannot be run.", pkgsysconfdir); + installation_ok = FALSE; + } gnc_gtk_add_rc_file(); gnucash_program = gnome_program_init( @@ -270,11 +289,29 @@ gnc_gnome_init (int argc, char **argv, const char * version) GNOME_PARAM_APP_DATADIR, pkgdatadir, GNOME_PARAM_APP_LIBDIR, pkglibdir, GNOME_PARAM_NONE); + if (!installation_ok) + { + /* The following string does not need translation because if + * it shows up, the program is unusable anyway. */ + gnc_error_dialog(NULL, "The installation directories were not found.\n\ndatadir=%s\nlibdir=%s\nsysconfdir=%s\n\nYour installation is incomplete and cannot be run.", + pkgdatadir, pkglibdir, pkgsysconfdir); + /* gnc_error_dialog must not be called before gnome_program_init. */ + } + g_free (prefix); g_free (pkgsysconfdir); g_free (pkgdatadir); g_free (pkglibdir); + /* Did the installation directory check fail? Terminate + * immediately because it will inevitably fail in the glade file + * lookup. */ + if (!installation_ok) + { + /* No correct installation? Shut down immediately. */ + exit(-1); + } + #ifdef G_OS_WIN32 /* workaround for bug #421792 */ xmlCleanupInputCallbacks();