]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Remove accidentally committed debug statement
[lyx.git] / src / BufferParams.cpp
index 60bfa3ab2226ad9d241c23776bea5ac5157c16bb..862c3ede40cbe739d54ebdef7a36fcbf3662786e 100644 (file)
@@ -308,7 +308,7 @@ bool inSystemDir(FileName const & document_dir, string & system_dir)
 
        string dir = document_dir.absFileName();
 
-       for (int i = 0; i < 2; ++i) {
+       for (int i = 0; i < 3; ++i) {
                dir = addPath(dir, "..");
                if (!fileSearch(dir, "configure.py").empty() &&
                    !fileSearch(dir, "chkconfig.ltx").empty()) {
@@ -754,6 +754,15 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                                origin.replace(0, sysdirprefix.length() - 1,
                                        package().system_support().absFileName());
                }
+               string const builddirprefix = "/buildlyxdir/";
+               if (prefixIs(origin, builddirprefix)) {
+                       string docsys;
+                       if (inSystemDir(filepath, docsys))
+                               origin.replace(0, builddirprefix.length() - 1, docsys);
+                       else
+                               origin.replace(0, builddirprefix.length() - 1,
+                                       package().system_support().absFileName());
+               }
        } else if (token == "\\begin_preamble") {
                readPreamble(lex);
        } else if (token == "\\begin_local_layout") {
@@ -1142,7 +1151,10 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
        string const relpath =
                to_utf8(makeRelPath(from_utf8(filepath), from_utf8(sysdir)));
        if (!prefixIs(relpath, "../") && !FileName::isAbsolute(relpath))
-               filepath = addPath("/systemlyxdir", relpath);
+               filepath = (prefixIs(docsys, package().build_support().realPath())) ?
+                                       addPath("/buildlyxdir", relpath)
+                                     : addPath("/systemlyxdir", relpath);
+
        else if (!save_transient_properties || !lyxrc.save_origin)
                filepath = "unavailable";
        os << "\\origin " << quoteIfNeeded(filepath) << '\n';
@@ -3290,7 +3302,7 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
                        break;
                }
        }
-       if (inputenc == "default" or features.isRequired("japanese")) {
+       if (inputenc == "default" || features.isRequired("japanese")) {
                // don't default to [utf8]{inputenc} with TeXLive >= 18
                os << "\\ifdefined\\UseRawInputEncoding\n";
                os << "  \\UseRawInputEncoding\\fi\n";