]> git.lyx.org Git - features.git/blobdiff - src/BufferParams.cpp
The way this was done here is inconsistent with how it is done
[features.git] / src / BufferParams.cpp
index f6e9649628aee795ebafd5cff23646c5569e04b3..269c74c45e9d114b1d3de64a581f89a57d13d9a9 100644 (file)
@@ -54,6 +54,7 @@
 #include "support/gettext.h"
 #include "support/Messages.h"
 #include "support/mutex.h"
+#include "support/Package.h"
 #include "support/Translator.h"
 #include "support/lstrings.h"
 
@@ -660,6 +661,11 @@ string BufferParams::readToken(Lexer & lex, string const & token,
        } else if (token == "\\origin") {
                lex.eatLine();
                origin = lex.getString();
+               string const sysdirprefix = "/systemlyxdir/";
+               if (prefixIs(origin, sysdirprefix)) {
+                       origin.replace(0, sysdirprefix.length() - 1,
+                               package().system_support().absFileName());
+               }
        } else if (token == "\\begin_preamble") {
                readPreamble(lex);
        } else if (token == "\\begin_local_layout") {
@@ -983,7 +989,13 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
        // Prints out the buffer info into the .lyx file given by file
 
        // the document directory
-       os << "\\origin " << buf->filePath() << '\n';
+       string filepath = buf->filePath();
+       string const sysdir = package().system_support().absFileName();
+       if (prefixIs(filepath, sysdir))
+               filepath.replace(0, sysdir.length(), "/systemlyxdir/");
+       else if (!lyxrc.save_origin)
+               filepath = "unavailable";
+       os << "\\origin " << filepath << '\n';
 
        // the textclass
        os << "\\textclass " << buf->includedFilePath(addName(buf->layoutPos(),
@@ -1344,7 +1356,8 @@ void BufferParams::validate(LaTeXFeatures & features) const
        }
 
        // some languages are only available via polyglossia
-       if (features.runparams().flavor == OutputParams::XETEX
+       if ((features.runparams().flavor == OutputParams::XETEX
+            || features.runparams().flavor == OutputParams::LUATEX)
            && (features.hasPolyglossiaExclusiveLanguages()
                || useNonTeXFonts))
                features.require("polyglossia");
@@ -2345,7 +2358,7 @@ OutputParams::FLAVOR BufferParams::getOutputFlavor(string const & format) const
        else if (dformat == "lyx")
                result = OutputParams::LYX;
        else if (dformat == "pdflatex")
-               result = OutputParams::PDFLATEX;
+               result = OutputParams::PDFLATEX;
        else if (dformat == "xetex")
                result = OutputParams::XETEX;
        else if (dformat == "luatex")