]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
another fix
[lyx.git] / src / buffer.C
index 335037aa3de68bc79a34249505dec109b7fb2883..086129577082ae50e2e40ad54fe8b6fe19ef0774 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "buffer.h"
 #include "bufferlist.h"
-#include "counters.h"
 #include "LyXAction.h"
 #include "lyxrc.h"
 #include "lyxlex.h"
@@ -154,7 +153,7 @@ const int LYX_FORMAT = 221;
 Buffer::Buffer(string const & file, bool ronly)
        : niceFile(true), lyx_clean(true), bak_clean(true),
          unnamed(false), dep_clean(0), read_only(ronly),
-         filename_(file), users(0), ctrs(new Counters)
+         filename_(file), users(0)
 {
        lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
        filepath_ = OnlyPath(file);
@@ -1154,6 +1153,7 @@ bool Buffer::readFile(LyXLex & lex, Paragraph * par)
                        if (dot != string::npos)
                                tmp_format.erase(dot, 1);
                        file_format = strToInt(tmp_format);
+                       //lyxerr << "format: " << file_format << endl;
                        if (file_format == LYX_FORMAT) {
                                // current format
                        } else if (file_format > LYX_FORMAT) {
@@ -1170,13 +1170,21 @@ bool Buffer::readFile(LyXLex & lex, Paragraph * par)
                                                     "Use LyX 0.10.x to read this!"));
                                        return false;
                                } else {
-                                       string const command = "lyx2lyx "
+                                       string command =
+                                               LibFileSearch("lyx2lyx", "lyx2lyx");
+                                       if (command.empty()) {
+                                               Alert::alert(_("ERROR!"),
+                                                            _("Can't find conversion script."));
+                                               return false;
+                                       }
+                                       command += " -t"
+                                               +tostr(LYX_FORMAT)+" "
                                                + QuoteName(filename_);
                                        cmd_ret const ret = RunCommand(command);
                                        if (ret.first) {
                                                Alert::alert(_("ERROR!"),
-                                                    _("An error occured while "
-                                                      "running the conversion script."));
+                                                            _("An error occured while "
+                                                              "running the conversion script."));
                                                return false;
                                        }
                                        istringstream is(ret.second);
@@ -3212,7 +3220,7 @@ vector<pair<string, string> > const Buffer::getBibkeyList() const
 
        if (!keys.empty())
                return keys;
+
        // Might be either using bibtex or a child has bibliography
        for (inset_iterator it = inset_const_iterator_begin();
                it != inset_const_iterator_end(); ++it) {
@@ -3331,12 +3339,6 @@ bool Buffer::isMultiLingual()
 }
 
 
-Counters & Buffer::counters() const
-{
-       return *ctrs.get();
-}
-
-
 void Buffer::inset_iterator::setParagraph()
 {
        while (pit != pend) {