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
This commit is contained in:
Scott Kostyshak 2013-03-29 11:34:04 -04:00
parent 70eddf2c30
commit d42c5fcd23

View File

@ -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());