Angus Leeming <[EMAIL PROTECTED]> writes: | Just committed. Attached FYI.
| +/** 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) | +{ | + Path p(directory); We should work very hard to get rid of this Path stuff. (I have that as one of my small projects.) Currently it is like a gobal variable, multi-threading (if we ever go there) will get really strange bugs because of this. | + | + // 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) { | + vector<string> const tmp = lyx::support::glob(*it); So possibly this glob should also take a dir param (and not use chdir in any way to get the result) -- Lgb