#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"
frontend::Application * theApp()
{
if (singleton_)
- return &singleton_->application();
+ return singleton_->pimpl_->application_.get();
else
return 0;
}
// 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
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;
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;
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;