+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:
"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);
+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
}
-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
return make_pair(pret, ret);
}
-} // namespace anon
-
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')
#endif
#include <vector>
+#include <utility>
#include "LString.h"
/// 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