]> git.lyx.org Git - lyx.git/blobdiff - src/LyX.cpp
GuiCharacter: INHERIT is OFF for the tristate buttons.
[lyx.git] / src / LyX.cpp
index 9cdad325985fddd20efa38410accf3485f7404bc..4e97f7ae64b92286ef5aa0a3152349942c1f2e32 100644 (file)
@@ -471,41 +471,39 @@ void LyX::earlyExit(int status)
 
 int LyX::init(int & argc, char * argv[])
 {
-       try {
-               // check for any spurious extra arguments
-               // other than documents
-               for (int argi = 1; argi < argc ; ++argi) {
-                       if (argv[argi][0] == '-') {
-                               lyxerr << to_utf8(
-                                       bformat(_("Wrong command line option `%1$s'. Exiting."),
-                                                       from_utf8(os::utf8_argv(argi)))) << endl;
-                               return EXIT_FAILURE;
-                       }
-               }
-
-               // Initialization of LyX (reads lyxrc and more)
-               LYXERR(Debug::INIT, "Initializing LyX::init...");
-               bool success = init();
-               LYXERR(Debug::INIT, "Initializing LyX::init...done");
-               if (!success)
+       // check for any spurious extra arguments
+       // other than documents
+       for (int argi = 1; argi < argc ; ++argi) {
+               if (argv[argi][0] == '-') {
+                       lyxerr << to_utf8(
+                               bformat(_("Wrong command line option `%1$s'. Exiting."),
+                               from_utf8(os::utf8_argv(argi)))) << endl;
                        return EXIT_FAILURE;
-               // Remaining arguments are assumed to be files to load.
-               for (int argi = 1; argi < argc; ++argi)
-                       pimpl_->files_to_load_.push_back(os::utf8_argv(argi));
-
-               // doesn't make sense to load the splash file in batch mode
-               if (use_gui && first_start) {
-                       pimpl_->files_to_load_.push_back(
-                               i18nLibFileSearch("examples", "splash.lyx").absFileName());
                }
+       }
 
-               return EXIT_SUCCESS;
+       // Initialization of LyX (reads lyxrc and more)
+       LYXERR(Debug::INIT, "Initializing LyX::init...");
+       bool success = init();
+       LYXERR(Debug::INIT, "Initializing LyX::init...done");
+       if (!success)
+               return EXIT_FAILURE;
+
+       // Remaining arguments are assumed to be files to load.
+       for (int argi = 1; argi < argc; ++argi)
+               pimpl_->files_to_load_.push_back(os::utf8_argv(argi));
 
-       } catch (exception const &e) {
-               // This can happen _in_theory_ in replaceEnvironmentPath
-               lyxerr << "Caught exception `" << e.what() << "'." << endl;
+       if (!use_gui && pimpl_->files_to_load_.empty()) {
+               lyxerr << to_utf8(_("Missing filename for this operation.")) << endl;
                return EXIT_FAILURE;
        }
+
+       if (first_start) {
+               pimpl_->files_to_load_.push_back(
+                       i18nLibFileSearch("examples", "splash.lyx").absFileName());
+       }
+
+       return EXIT_SUCCESS;
 }