X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyx_main.C;h=97f71100ff10ece894cf3e99837d70daf1cdbd23;hb=27a777ccc624b19c5d1961a6279c0db97594c0fb;hp=1deaa8ca251cef5ab784c43b0bf8b3f3cb6093dc;hpb=9a600f0e3027e84d6b9be41d5521a1bd5ad340df;p=lyx.git diff --git a/src/lyx_main.C b/src/lyx_main.C index 1deaa8ca25..97f71100ff 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -53,6 +53,7 @@ #include "support/filetools.h" #include "support/lyxlib.h" #include "support/convert.h" +#include "support/ExceptionMessage.h" #include "support/os.h" #include "support/package.h" #include "support/path.h" @@ -197,7 +198,7 @@ struct LyX::Singletons frontend::Application * theApp() { if (singleton_) - return &singleton_->application(); + return singleton_->pimpl_->application_.get(); else return 0; } @@ -395,9 +396,17 @@ int LyX::exec(int & argc, char * argv[]) // we need to parse for "-dbg" and "-help" easyParse(argc, argv); - support::init_package(to_utf8(from_local8bit(argv[0])), + try { support::init_package(to_utf8(from_local8bit(argv[0])), cl_system_support, cl_user_support, support::top_build_dir_is_one_level_up); + } catch (support::ExceptionMessage const & message) { + if (message.type_ == support::ErrorException) { + Alert::error(message.title_, message.details_); + exit(1); + } else if (message.type_ == support::WarningException) { + Alert::warning(message.title_, message.details_); + } + } if (!use_gui) { // FIXME: create a ConsoleApplication @@ -1313,7 +1322,8 @@ int parse_version(string const &, string const &) int parse_sysdir(string const & arg, string const &) { if (arg.empty()) { - lyxerr << to_utf8(_("Missing directory for -sysdir switch")) << endl; + Alert::error(_("No system directory"), + _("Missing directory for -sysdir switch")); exit(1); } cl_system_support = arg; @@ -1323,7 +1333,8 @@ int parse_sysdir(string const & arg, string const &) int parse_userdir(string const & arg, string const &) { if (arg.empty()) { - lyxerr << to_utf8(_("Missing directory for -userdir switch")) << endl; + Alert::error(_("No user directory"), + _("Missing directory for -userdir switch")); exit(1); } cl_user_support = arg; @@ -1333,7 +1344,8 @@ int parse_userdir(string const & arg, string const &) int parse_execute(string const & arg, string const &) { if (arg.empty()) { - lyxerr << to_utf8(_("Missing command string after --execute switch")) << endl; + Alert::error(_("Incomplete command"), + _("Missing command string after --execute switch")); exit(1); } batch = arg;