mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 02:49:46 +00:00
Set correct path to (biblatex) bibliography databases that are entered relative to child documents.
Fixes: #11105
This commit is contained in:
parent
503c7c1688
commit
2ecc3b09c6
@ -3150,9 +3150,28 @@ vector<docstring> const Buffer::prepareBibFilePaths(OutputParams const & runpara
|
||||
string utf8input = to_utf8(bit.first);
|
||||
string database =
|
||||
prepareFileNameForLaTeX(utf8input, ".bib", runparams.nice);
|
||||
FileName const try_in_file =
|
||||
FileName try_in_file =
|
||||
makeAbsPath(database + ".bib", filePath());
|
||||
bool const not_from_texmf = try_in_file.isReadableFile();
|
||||
bool not_from_texmf = try_in_file.isReadableFile();
|
||||
// If the file has not been found, try with the real file name
|
||||
// (it might come from a child in a sub-directory)
|
||||
if (!not_from_texmf) {
|
||||
try_in_file = bit.second;
|
||||
if (try_in_file.isReadableFile()) {
|
||||
// Check if the file is in texmf
|
||||
FileName kpsefile(findtexfile(changeExtension(utf8input, "bib"), "bib", true));
|
||||
not_from_texmf = kpsefile.empty()
|
||||
|| kpsefile.absFileName() != try_in_file.absFileName();
|
||||
if (not_from_texmf)
|
||||
// If this exists, make path relative to the master
|
||||
// FIXME Unicode
|
||||
database =
|
||||
removeExtension(prepareFileNameForLaTeX(
|
||||
to_utf8(makeRelPath(from_utf8(try_in_file.absFileName()),
|
||||
from_utf8(filePath()))),
|
||||
".bib", runparams.nice));
|
||||
}
|
||||
}
|
||||
|
||||
if (!runparams.inComment && !runparams.dryrun && !runparams.nice &&
|
||||
not_from_texmf) {
|
||||
|
@ -1124,7 +1124,8 @@ cmd_ret const runCommand(string const & cmd)
|
||||
}
|
||||
|
||||
|
||||
FileName const findtexfile(string const & fil, string const & /*format*/)
|
||||
FileName const findtexfile(string const & fil, string const & /*format*/,
|
||||
bool const onlykpse)
|
||||
{
|
||||
/* There is no problem to extend this function too use other
|
||||
methods to look for files. It could be setup to look
|
||||
@ -1137,9 +1138,11 @@ FileName const findtexfile(string const & fil, string const & /*format*/)
|
||||
|
||||
// If the file can be found directly, we just return a
|
||||
// absolute path version of it.
|
||||
FileName const absfile(makeAbsPath(fil));
|
||||
if (absfile.exists())
|
||||
return absfile;
|
||||
if (!onlykpse) {
|
||||
FileName const absfile(makeAbsPath(fil));
|
||||
if (absfile.exists())
|
||||
return absfile;
|
||||
}
|
||||
|
||||
// Now we try to find it using kpsewhich.
|
||||
// It seems from the kpsewhich manual page that it is safe to use
|
||||
|
@ -305,7 +305,8 @@ bool readLink(FileName const & file, FileName & link);
|
||||
* \param format The file format as used by kpsewhich, e.g. "bib", "bst" etc.
|
||||
*/
|
||||
FileName const findtexfile(std::string const & fil,
|
||||
std::string const & format);
|
||||
std::string const & format,
|
||||
bool const onlykpse = false);
|
||||
|
||||
/** \param file1, file2 the two files to be compared. Must have absolute paths.
|
||||
* \returns 1 if \c file1 has a more recent timestamp than \c file2,
|
||||
|
Loading…
Reference in New Issue
Block a user