* src/LaTeX.C

-  (insertIfExists): new helper function.
	- (handleFoundFile): minor refactoring.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17289 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2007-02-21 09:53:50 +00:00
parent 80e188281e
commit a6a4029f0d

View File

@ -723,6 +723,17 @@ int LaTeX::scanLogFile(TeXErrors & terr)
namespace {
bool insertIfExists(FileName const & absname, DepTable & head)
{
fs::path const path = absname.toFilesystemEncoding();
if (fs::exists(path) && !fs::is_directory(path)) {
head.insert(absname, true);
return true;
}
return false;
}
bool handleFoundFile(string const & ff, DepTable & head)
{
// convert from native os path to unix path
@ -746,11 +757,7 @@ bool handleFoundFile(string const & ff, DepTable & head)
// since this file cannot be a file generated by
// the latex run.
FileName absname(foundfile);
if (fs::exists(absname.toFilesystemEncoding()) &&
!fs::is_directory(absname.toFilesystemEncoding())) {
head.insert(absname, true);
return true;
} else {
if (!insertIfExists(absname, head)) {
// check for spaces
string strippedfile = foundfile;
while (contains(strippedfile, " ")) {
@ -759,14 +766,11 @@ bool handleFoundFile(string const & ff, DepTable & head)
string const stripoff =
rsplit(tmp, strippedfile, ' ');
absname.set(strippedfile);
if (fs::exists(absname.toFilesystemEncoding()) &&
!fs::is_directory(absname.toFilesystemEncoding())) {
head.insert(absname, true);
if (insertIfExists(absname, head))
return true;
}
}
}
}
string onlyfile = onlyFilename(foundfile);
FileName absname(makeAbsPath(onlyfile));
@ -788,8 +792,8 @@ bool handleFoundFile(string const & ff, DepTable & head)
// (2) foundfile is in the tmpdir
// insert it into head
if (fs::exists(absname.toFilesystemEncoding()) &&
!fs::is_directory(absname.toFilesystemEncoding())) {
fs::path const path = absname.toFilesystemEncoding();
if (fs::exists(path) && !fs::is_directory(path)) {
static regex unwanted("^.*\\.(aux|log|dvi|bbl|ind|glo)$");
if (regex_match(onlyfile, unwanted)) {
lyxerr[Debug::DEPEND]