]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/file-path.cc
release: 1.3.90
[lilypond.git] / flower / file-path.cc
index 10df133946ee45fe911d512d60a349332c912dc5..501554ea656580ef87c357412fa29bd5ad406dea 100644 (file)
@@ -2,7 +2,10 @@
    path.cc - manipulation of paths and filenames.
 */
 
+
 #include <stdio.h>
+#include <errno.h>
+#include <sys/stat.h>
 
 #include "config.h"
 #include "file-path.hh"
@@ -98,6 +101,17 @@ File_path::find (String nm) const
       path += nm;
 
       DEBUG_OUT << path << "? ";
+
+      /*
+       Check if directory. TODO: encapsulate for autoconf
+       */
+      struct stat sbuf;
+      if (stat (path.ch_C(), &sbuf) == ENOENT)
+       continue;
+      
+      if (!(sbuf.st_mode & __S_IFREG))
+       continue;
+
       FILE *f = fopen (path.ch_C(), "r"); // ugh!
       if (f)
        {