Return early from the short path.

This commit is contained in:
Richard Kimberly Heck 2020-04-25 17:33:49 -04:00
parent f1d5926a5d
commit aa794a8806

View File

@ -766,11 +766,30 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
// in a comment or doing a dryrun
return;
if (isInputOrInclude(params()) &&
isLyXFileName(included_file.absFileName())) {
// if it's a LyX file and we're inputting or including,
// try to load it so we can write the associated latex
if (!isInputOrInclude(params()) ||
!isLyXFileName(included_file.absFileName())) {
// In this case, it's not a LyX file, so we copy the file
// to the temp dir, so that .aux files etc. are not created
// in the original dir. Files included by this file will be
// found via either the environment variable TEXINPUTS, or
// input@path, see ../Buffer.cpp.
unsigned long const checksum_in = included_file.checksum();
unsigned long const checksum_out = writefile.checksum();
if (checksum_in != checksum_out) {
if (!included_file.copyTo(writefile)) {
// FIXME UNICODE
LYXERR(Debug::LATEX,
to_utf8(bformat(_("Could not copy the file\n%1$s\n"
"into the temporary directory."),
from_utf8(included_file.absFileName()))));
}
}
return;
}
// it's a LyX file and we're inputting or including, so
// try to load it so we can write the associated latex
Buffer * tmp = loadIfNeeded();
if (!tmp) {
if (!runparams.silent) {
@ -911,26 +930,6 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
throw ExceptionMessage(ErrorException, _("Error: "), msg);
}
}
} else {
// In this case, it's not a LyX file, so we copy the file
// to the temp dir, so that .aux files etc. are not created
// in the original dir. Files included by this file will be
// found via either the environment variable TEXINPUTS, or
// input@path, see ../Buffer.cpp.
unsigned long const checksum_in = included_file.checksum();
unsigned long const checksum_out = writefile.checksum();
if (checksum_in != checksum_out) {
if (!included_file.copyTo(writefile)) {
// FIXME UNICODE
LYXERR(Debug::LATEX,
to_utf8(bformat(_("Could not copy the file\n%1$s\n"
"into the temporary directory."),
from_utf8(included_file.absFileName()))));
return;
}
}
}
}