#include <config.h>
#include "support/globbing.h"
+#include "support/path.h"
#include <glob.h>
namespace lyx {
namespace support {
-vector<string> const glob(string const & pattern, int flags)
+void glob(vector<string> & matches,
+ string const & pattern,
+ string const & working_dir,
+ int flags)
{
+ Path p(working_dir);
+
glob_t glob_buffer;
glob_buffer.gl_offs = 0;
glob(pattern.c_str(), flags, 0, &glob_buffer);
- vector<string> const matches(glob_buffer.gl_pathv,
- glob_buffer.gl_pathv +
- glob_buffer.gl_pathc);
+
+ matches.insert(matches.end(),
+ glob_buffer.gl_pathv,
+ glob_buffer.gl_pathv + glob_buffer.gl_pathc);
+
globfree(&glob_buffer);
- return matches;
}
} // namespace support