fix --export and batch nogui

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4880 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-08-06 14:40:13 +00:00
parent 84bdbe2eac
commit 2d30150424
2 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,6 @@
2002-08-06 John Levon <levon@movementarian.org>
* lyx_main.C: fix cmdline batch handling
2002-08-06 André Pönitz <poenitz@gmx.net> 2002-08-06 André Pönitz <poenitz@gmx.net>

View File

@ -25,6 +25,7 @@
#include "lyxlex.h" #include "lyxlex.h"
#include "bufferlist.h" #include "bufferlist.h"
#include "buffer.h"
#include "lyxserver.h" #include "lyxserver.h"
#include "kbmap.h" #include "kbmap.h"
#include "lyxfunc.h" #include "lyxfunc.h"
@ -116,12 +117,21 @@ LyX::LyX(int & argc, char * argv[])
files.push_back(i18nLibFileSearch("examples", "splash.lyx")); files.push_back(i18nLibFileSearch("examples", "splash.lyx"));
} }
#if 0 // FIXME: GUII
// Execute batch commands if available // Execute batch commands if available
if (!batch_command.empty()) { if (!batch_command.empty()) {
lyxerr[Debug::INIT] << "About to handle -x '" lyxerr[Debug::INIT] << "About to handle -x '"
<< batch_command << "'" << endl; << batch_command << "'" << endl;
Buffer * last_loaded = 0;
vector<string>::iterator it = files.begin();
vector<string>::iterator end = files.end();
for (; it != end; ++it) {
last_loaded = bufferlist.loadLyXFile(*it);
}
files.clear();
// no buffer loaded, create one // no buffer loaded, create one
if (!last_loaded) if (!last_loaded)
last_loaded = bufferlist.newFile("tmpfile", string()); last_loaded = bufferlist.newFile("tmpfile", string());
@ -131,13 +141,11 @@ LyX::LyX(int & argc, char * argv[])
// try to dispatch to last loaded buffer first // try to dispatch to last loaded buffer first
bool const dispatched = last_loaded->dispatch(batch_command, &success); bool const dispatched = last_loaded->dispatch(batch_command, &success);
// if this was successful, finish if (success) {
if (dispatched) {
QuitLyX(); QuitLyX();
exit(!success); exit(!success);
} }
} }
#endif
lyx_gui::start(batch_command, files); lyx_gui::start(batch_command, files);
} }