From: Georg Baum Date: Sun, 4 Mar 2007 13:22:38 +0000 (+0000) Subject: Fix bug 3305 X-Git-Tag: 1.6.10~10628 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=62bb6150ee679149384fdf386af457626b657811;p=features.git Fix bug 3305 * src/LaTeX.C (insertIfExists): Catch boost::filesystem exceptions, since they are not errors in this context (handleFoundFile): ditto git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17405 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/LaTeX.C b/src/LaTeX.C index 7991969383..6943eb4b9f 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -758,8 +758,18 @@ namespace { bool insertIfExists(FileName const & absname, DepTable & head) { - fs::path const path = absname.toFilesystemEncoding(); - if (fs::exists(path) && !fs::is_directory(path)) { + bool exists; + try { + fs::path const path = absname.toFilesystemEncoding(); + exists = fs::exists(path) && !fs::is_directory(path); + } + catch (fs::filesystem_error const & fe) { + // This was probably no file at all. + lyxerr[Debug::DEPEND] << "Got error `" << fe.what() + << "' while checking whether file `" << absname + << "' exists and is no directory." << endl; + } + if (exists) { head.insert(absname, true); return true; } @@ -809,8 +819,18 @@ bool handleFoundFile(string const & ff, DepTable & head) FileName absname(makeAbsPath(onlyfile)); // check for spaces - while (contains(foundfile, " ")) { - if (fs::exists(absname.toFilesystemEncoding())) + while (contains(foundfile, ' ')) { + bool exists; + try { + exists = fs::exists(absname.toFilesystemEncoding()); + } + catch (fs::filesystem_error const & fe) { + // This was probably no file at all. + lyxerr[Debug::DEPEND] << "Got error `" << fe.what() + << "' while checking whether file `" + << absname << "' exists." << endl; + } + if (exists) // everything o.k. break; else { @@ -826,8 +846,18 @@ bool handleFoundFile(string const & ff, DepTable & head) // (2) foundfile is in the tmpdir // insert it into head - fs::path const path = absname.toFilesystemEncoding(); - if (fs::exists(path) && !fs::is_directory(path)) { + bool exists; + try { + fs::path const path = absname.toFilesystemEncoding(); + exists = fs::exists(path) && !fs::is_directory(path); + } + catch (fs::filesystem_error const & fe) { + // This was probably no file at all. + lyxerr[Debug::DEPEND] << "Got error `" << fe.what() + << "' while checking whether file `" << absname + << "' exists and is no directory." << endl; + } + if (exists) { static regex unwanted("^.*\\.(aux|log|dvi|bbl|ind|glo)$"); if (regex_match(onlyfile, unwanted)) { lyxerr[Debug::DEPEND]