]> git.lyx.org Git - lyx.git/blob - src/support/globbing.C
make "make distcheck" work
[lyx.git] / src / support / globbing.C
1 /**
2  * \file globbing.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Angus Leeming
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "support/globbing.h"
14 #include "support/path.h"
15
16 #include <glob.h>
17
18 using std::string;
19 using std::vector;
20
21
22 namespace lyx {
23 namespace support {
24
25 void glob(vector<string> & matches,
26           string const & pattern,
27           string const & working_dir,
28           int flags)
29 {
30         Path p(working_dir);
31
32         glob_t glob_buffer;
33         glob_buffer.gl_offs = 0;
34         glob(pattern.c_str(), flags, 0, &glob_buffer);
35
36         matches.insert(matches.end(),
37                        glob_buffer.gl_pathv,
38                        glob_buffer.gl_pathv + glob_buffer.gl_pathc);
39
40         globfree(&glob_buffer);
41 }
42
43 } // namespace support
44 } // namespace lyx