]> git.lyx.org Git - features.git/commitdiff
Fix bug 3305
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sun, 4 Mar 2007 13:22:38 +0000 (13:22 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sun, 4 Mar 2007 13:22:38 +0000 (13:22 +0000)
* 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

src/LaTeX.C

index 79919693835c162ddb5fdfe1c9e1d26f9805a64a..6943eb4b9f2c27f4301031f866fe8465352cbefa 100644 (file)
@@ -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]