diff --git a/rtgui/main.cc b/rtgui/main.cc index 2ae442e5a..55d27125c 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -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 (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 (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; } diff --git a/rtgui/options.cc b/rtgui/options.cc index 0cc20e68a..d5e422159 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -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); } }