Add useful error message when running gnucash from an incomplete installation (such as from the build directory).

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20537 57a11ea4-9604-0410-9ed3-97b8803252fd
pull/1/head
Christian Stimming 15 years ago
parent b82aad54b6
commit a1f90ceba1

@ -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);

@ -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));

@ -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();

Loading…
Cancel
Save