+/** Given a string "<glob> <glob> <glob>", expand each glob in turn.
+ * Any glob that cannot be expanded is ignored silently.
+ * Invokes \c convert_brace_glob and \c glob internally, so use only
+ * on systems supporting the Posix function 'glob'.
+ * \param mask the string "<glob> <glob> <glob>".
+ * \param directory the current working directory from
+ * which \c glob is invoked.
+ * \returns a vector of all matching file names.
+ */
+vector<string> const expand_globs(string const & mask,
+ string const & directory)
+{
+ // Split into individual globs and then call 'glob' on each one.
+ typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
+ boost::char_separator<char> const separator(" ");
+
+ vector<string> matches;
+ Tokenizer const tokens(mask, separator);
+ Tokenizer::const_iterator it = tokens.begin();
+ Tokenizer::const_iterator const end = tokens.end();
+ for (; it != end; ++it)
+ lyx::support::glob(matches, *it, directory);
+
+ return matches;
+}
+
+