An alert window is opened on event catching from Options::load (#4428)

This commit is contained in:
Hombre 2018-03-09 22:08:29 +01:00
parent 185f072481
commit 01f8f4123a
2 changed files with 10 additions and 9 deletions

View File

@ -628,20 +628,19 @@ int main (int argc, char **argv)
int ret = 0;
Glib::ustring fatalError;
try {
Options::load();
} catch (Options::Error &e) {
std::cout << "ERROR: " << e.get_msg() << std::endl;
std::cerr << "Fatal error!" << std::endl;
std::cerr << "The RT_SETTINGS and/or RT_PATH environment variables are set, but use a relative path. The path must be absolute!" << std::endl;
return -2;
fatalError = e.get_msg();
}
gdk_threads_set_lock_functions (G_CALLBACK (myGdkLockEnter), (G_CALLBACK (myGdkLockLeave)));
gdk_threads_init();
gtk_init (&argc, &argv); // use the "--g-fatal-warnings" command line flag to make warnings fatal
if (remote) {
if (fatalError.empty() && remote) {
char *app_argv[2] = { const_cast<char *> (argv0.c_str()) };
int app_argc = 1;
@ -653,7 +652,7 @@ int main (int argc, char **argv)
RTApplication app;
ret = app.run (app_argc, app_argv);
} else {
if (init_rt()) {
if (fatalError.empty() && init_rt()) {
Gtk::Main m (&argc, &argv);
gdk_threads_enter();
const std::unique_ptr<RTWindow> rtWindow (create_rt_window());
@ -679,7 +678,7 @@ int main (int argc, char **argv)
cleanup_rt();
} else {
Gtk::Main m (&argc, &argv);
Gtk::MessageDialog msgd ("Fatal error!\nThe RT_SETTINGS and/or RT_PATH environment variables are set, but use a relative path. The path must be absolute!", true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
Gtk::MessageDialog msgd (Glib::ustring::compose("FATAL ERROR!\n\n%1", fatalError), true, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msgd.run ();
ret = -2;
}

View File

@ -102,7 +102,8 @@ void Options::updatePaths()
g_mkdir_with_parents (profilePath.c_str (), 511);
if (!checkDirPath (profilePath, "")) { // had problems with mkdir_with_parents return value on OS X, just check dir again
printf ("Error: creation of the user's processing profile directory \"%s\" failed!\n", profilePath.c_str());
Glib::ustring msg = Glib::ustring::compose ("Creation of the user's processing profile directory \"%1\" failed!\n", profilePath);
throw Error (msg);
}
}
@ -130,7 +131,8 @@ void Options::updatePaths()
g_mkdir_with_parents (tmpPath.c_str (), 511);
if (!checkDirPath (tmpPath, "")) {
printf ("Error: creation of the user's processing profile directory \"%s\" failed!\n", tmpPath.c_str());
Glib::ustring msg = Glib::ustring::compose ("Creation of the user's processing profile directory \"%1\" failed!\n", tmpPath.c_str());
throw Error (msg);
}
}