Use lyxconvert script for reading old files

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4745 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2002-07-22 17:11:41 +00:00
parent eb28793c05
commit 3f52b62838
5 changed files with 31 additions and 12 deletions

View File

@ -1,3 +1,8 @@
2002-07-22 Dekel Tsur <dekelts@tau.ac.il>
* buffer.C (readFile): Run the lyxconvert script in order to read
old files.
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* LyXAction.C:

View File

@ -1713,10 +1713,22 @@ bool Buffer::readFile(LyXLex & lex, Paragraph * par)
"Use LyX 0.10.x to read this!"));
return false;
} else if (file_format < 220) {
Alert::alert(_("ERROR!"),
_("Old LyX file format found. "
"Use LyX 1.2.x to read this!"));
return false;
//Alert::alert(_("Warning!"),
// _("Old LyX file format found. "
// "Running conversion script"));
string command = "lyxconvert "
+ QuoteName(filename_);
cmd_ret const ret = RunCommand(command);
if (ret.first) {
Alert::alert(_("ERROR!"),
_("An error occured while "
"running the conversion script."));
return false;
}
istringstream is(ret.second);
LyXLex tmplex(0, 0);
tmplex.setStream(is);
return readFile(tmplex);
}
}
bool the_end = readLyXformat2(lex, par);

View File

@ -1,3 +1,7 @@
2002-07-22 Dekel Tsur <dekelts@tau.ac.il>
* filetools.C (RunCommand): Made public
2002-07-22 John Levon <moz@compsoc.man.ac.uk>
* limited_stack.h: fix comment, remove un-needed header

View File

@ -1286,11 +1286,7 @@ bool LyXReadLink(string const & file, string & link, bool resolve)
}
namespace {
typedef pair<int, string> cmdret;
cmdret const do_popen(string const & cmd)
cmd_ret const RunCommand(string const & cmd)
{
// One question is if we should use popen or
// create our own popen based on fork, exec, pipe
@ -1314,8 +1310,6 @@ cmdret const do_popen(string const & cmd)
return make_pair(pret, ret);
}
} // namespace anon
string const findtexfile(string const & fil, string const & /*format*/)
{
@ -1355,7 +1349,7 @@ string const findtexfile(string const & fil, string const & /*format*/)
// should help it by setting additional path in the approp. envir.var.
string const kpsecmd = "kpsewhich " + fil;
cmdret const c = do_popen(kpsecmd);
cmd_ret const c = RunCommand(kpsecmd);
lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n"
<< "kpse result = `" << strip(c.second, '\n')

View File

@ -12,6 +12,7 @@
#endif
#include <vector>
#include <utility>
#include "LString.h"
@ -209,5 +210,8 @@ void removeAutosaveFile(string const & filename);
/// read the BoundingBox entry from a ps/eps/pdf-file
string const readBB_from_PSFile(string const & file);
typedef std::pair<int, string> cmd_ret;
cmd_ret const RunCommand(string const & cmd);
#endif