]> git.lyx.org Git - lyx.git/commitdiff
* insetcite.C (getNatbibLabel): prevent filesystem exception
authorJürgen Spitzmüller <spitz@lyx.org>
Sat, 19 Aug 2006 10:39:03 +0000 (10:39 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sat, 19 Aug 2006 10:39:03 +0000 (10:39 +0000)
if the bib file is in a non-readable directory (bug 2782).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14807 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/insetcite.C

index ff2ee37b940a54e76c5551dc13cb6fadb63ce9d8..bcc8e1cd7dacd10f607f69775d2bc1ff1df4186e 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "frontends/controllers/biblio.h"
 
+#include "support/fs_extras.h"
 #include "support/lstrings.h"
 
 #include <boost/filesystem/operations.hpp>
@@ -70,8 +71,8 @@ string const getNatbibLabel(Buffer const & buffer,
        for (vector<string>::const_iterator it = bibfilesCache.begin();
                        it != bibfilesCache.end(); ++ it) {
                string const f = *it;
-               if (!fs::exists(f)) {
-                       lyxerr << "Couldn't find bibtex file " << f << endl;
+               if (!fs::exists(f) || !fs::is_readable(fs::path(f).branch_path())) {
+                       lyxerr << "Couldn't find or read bibtex file " << f << endl;
                        changed = true;
                } else if (bibfileStatus[f] != fs::last_write_time(f)) {
                        changed = true;