Lars Gullik Bjønnes wrote:
> Georg Baum <[EMAIL PROTECTED]>
> writes:
>
> | I don't know of such a path validity check, but maybe I overlooked it.
> | Are you aware of such a function?
>
>
> I only know of these (in boost):
>
> http://www.boost.org/libs/filesystem/doc/protability_guide.htm#name_check
Ah, I did not know that these can be called standalone. Uwe, could you
please test whether this patch still fixes the problem?
Georg
Index: src/LaTeX.C
===================================================================
--- src/LaTeX.C (Revision 17412)
+++ src/LaTeX.C (Arbeitskopie)
@@ -758,18 +758,13 @@ namespace {
bool insertIfExists(FileName const & absname, DepTable & head)
{
- 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 (!fs::native(absname.toFilesystemEncoding())) {
+ lyxerr[Debug::DEPEND] << '`' << absname.absFilename()
+ << "' is no valid file name." << endl;
+ return false;
}
- if (exists) {
+ fs::path const path(absname.toFilesystemEncoding());
+ if (fs::exists(path) && !fs::is_directory(path)) {
head.insert(absname, true);
return true;
}
@@ -820,15 +821,12 @@ bool handleFoundFile(string const & ff,
// check for spaces
while (contains(foundfile, ' ')) {
- bool exists;
- try {
+ bool exists = fs::native(absname.toFilesystemEncoding());
+ if (exists)
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;
+ else {
+ lyxerr[Debug::DEPEND] << '`' << absname.absFilename()
+ << "' is no valid file name." << endl;
}
if (exists)
// everything o.k.
@@ -846,16 +844,13 @@ bool handleFoundFile(string const & ff,
// (2) foundfile is in the tmpdir
// insert it into head
- bool exists;
- try {
+ bool exists = fs::native(absname.toFilesystemEncoding());
+ if (exists) {
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;
+ } else {
+ lyxerr[Debug::DEPEND] << '`' << absname.absFilename()
+ << "' is no valid file name." << endl;
}
if (exists) {
static regex unwanted("^.*\\.(aux|log|dvi|bbl|ind|glo)$");