diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 481a7c6ab4..b7b27c4073 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -467,14 +467,31 @@ string Buffer::logName(LogType * type) const changeExtension(filename, formats.extension(bufferFormat()) + ".out")))); - // If no Latex log or Build log is newer, show Build log + // Also consider the master buffer log file + FileName masterfname = fname; + LogType mtype; + if (masterBuffer() != this) { + string const mlogfile = masterBuffer()->logName(&mtype); + masterfname = FileName(mlogfile); + } + // If no Latex log or Build log is newer, show Build log if (bname.exists() && - (!fname.exists() || fname.lastModified() < bname.lastModified())) { + ((!fname.exists() && !masterfname.exists()) + || (fname.lastModified() < bname.lastModified() + && masterfname.lastModified() < bname.lastModified()))) { LYXERR(Debug::FILES, "Log name calculated as: " << bname); if (type) *type = buildlog; return bname.absFilename(); + // If we have a newer master file log or only a master log, show this + } else if (fname != masterfname + && (!fname.exists() && masterfname.exists() + || fname.lastModified() < masterfname.lastModified())) { + LYXERR(Debug::FILES, "Log name calculated as: " << masterfname); + if (type) + *type = mtype; + return masterfname.absFilename(); } LYXERR(Debug::FILES, "Log name calculated as: " << fname); if (type) diff --git a/src/Buffer.h b/src/Buffer.h index 74c378cadc..72c0d8ca09 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -283,7 +283,7 @@ public: */ std::string latexName(bool no_path = true) const; - /// Get thee name and type of the log. + /// Get the name and type of the log. std::string logName(LogType * type = 0) const; /// Change name of buffer. Updates "read-only" flag.