From: Scott Kostyshak Date: Fri, 29 Mar 2013 15:34:04 +0000 (-0400) Subject: Exit with error if required filename is not given X-Git-Tag: 2.1.0beta1~447 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=d42c5fcd233a17c1693fd4de3702fc2ad998592d;p=features.git Exit with error if required filename is not given This is a second attempt to fix the problem described in 6df4a7bb (2c2c1767 reverted the first attempt). The solution here is more general: if we get to a certain point in the code and there is no filename, an error is given. The following command now gives an error: lyx -e pdf2 And the following command continues to not give an error: lyx myfile.lyx -e pdf --- diff --git a/src/LyX.cpp b/src/LyX.cpp index 2096be7a77..55fb0711ad 100644 --- a/src/LyX.cpp +++ b/src/LyX.cpp @@ -468,6 +468,11 @@ int LyX::init(int & argc, char * argv[]) for (int argi = 1; argi < argc; ++argi) pimpl_->files_to_load_.push_back(os::utf8_argv(argi)); + 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());