- String path = elem(i);
- String sep = to_str (DIRSEP);
- String right(path.right_str (1));
- if (path.length_i () && right != sep)
- path += to_str (DIRSEP);
-
- path += nm;
-
- DEBUG_OUT << path << "? ";
-
-#if 0
- /*
- 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;
-#endif
-#if !STAT_MACROS_BROKEN
- struct stat sbuf;
- if (stat (path.ch_C (), &sbuf) == ENOENT)
- continue;
-
- if (S_ISDIR (sbuf.st_mode))
- continue;
-#endif
+ File_name file_name (name);
+ File_name dir = (string) dirs_[i];
+ file_name.root_ = dir.root_;
+ dir.root_ = "";
+ if (file_name.dir_.empty ())
+ file_name.dir_ = dir.to_string ();
+ else if (!dir.to_string ().empty ())
+ file_name.dir_ = dir.to_string ()
+ + ::to_string (DIRSEP) + file_name.dir_;
+ if (is_file (file_name.to_string ()))
+ return file_name.to_string ();
+ }
+ return "";
+}
+
+/*
+ Try to find
+
+ file.EXT,