Update Brazilian Portuguese translation
[dasher.git] / Src / Common / Globber.cpp
blob9a4153b88e5b89f30a3e504fc16bad61193781ab
1 //
2 // Globber.cpp
3 // Dasher
4 //
5 // Created by Alan Lawrence on 21/9/11.
6 // Copyright 2011 Cambridge University. All rights reserved.
7 //
9 #include "Globber.h"
10 #include <glob.h>
11 #include <string.h>
13 void globScan(AbstractParser *parser, const char **usrPaths, const char **sysPaths) {
14 int flags = GLOB_MARK | GLOB_NOSORT;
15 glob_t info;
16 int numUser = 0;
17 while (*usrPaths) {
18 glob(*usrPaths++, flags, NULL, &info); //NULL error function
19 flags |= GLOB_APPEND;
21 numUser = info.gl_pathc;
22 while (*sysPaths) {
23 glob(*sysPaths++, flags, NULL, &info);
24 flags |= GLOB_APPEND;
27 if (info.gl_pathc) {
28 //user paths first
29 for (char **fname = info.gl_pathv; *fname; fname++, numUser=(numUser>0 ? numUser-1 : 0)) {
30 if ((*fname)[strlen(*fname)-1]=='/') continue; //directories were marked by GLOB_MARK
31 parser->ParseFile(*fname, numUser>0);
34 globfree(&info);