#include <csignal>
#include <iostream>
+using namespace lyx::support;
+
using std::vector;
using std::endl;
Buffer * last_loaded = 0;
- vector<string>::iterator it = files.begin();
- vector<string>::iterator end = files.end();
+ vector<string>::const_iterator it = files.begin();
+ vector<string>::const_iterator end = files.end();
+
for (; it != end; ++it) {
- last_loaded = bufferlist.newBuffer(*it, false);
+ // get absolute path of file and add ".lyx" to
+ // the filename if necessary
+ string s = FileSearch(string(), *it, "lyx");
+ if (s.empty()) {
+ s = *it;
+ }
+
+ last_loaded = bufferlist.newBuffer(s, false);
last_loaded->parseError.connect(boost::bind(&LyX::printError, this, _1));
- loadLyXFile(last_loaded, *it);
+ loadLyXFile(last_loaded, s);
}
files.clear();
- // no buffer loaded, create one
- string const tmpfile = "tmpfile";
- if (!last_loaded)
- last_loaded = newFile(tmpfile, string());
-
bool success = false;
// try to dispatch to last loaded buffer first
lyxerr << "Bye." << endl;
if (err_sig!= SIGHUP &&
(!GetEnv("LYXDEBUG").empty() || err_sig == SIGSEGV))
- lyx::abort();
+ lyx::support::abort();
exit(0);
}
void LyX::printError(ErrorItem const & ei)
{
- std::cerr << _("LyX: ") << ei.error
+ std::cerr << _("LyX: ") << ei.error
<< ':' << ei.description << std::endl;
}
system_lcolor = lcolor;
string prefsfile = "preferences";
- // back compatibility to lyxs < 1.1.6
+ // back compatibility to lyxs < 1.1.6
if (LibFileSearch(string(), prefsfile).empty())
prefsfile = "lyxrc";
if (!LibFileSearch(string(), prefsfile).empty())