-bool ReadConfigDir(Configuration &Conf,string Dir,bool AsSectional,
- unsigned Depth)
-{
- static const char *BadExts[] = {".disabled",".dpkg-old",".dpkg-dist",
- ".rpmsave",".rpmorig","~",",v",0};
-
- DIR *D = opendir(Dir.c_str());
- if (D == 0)
- return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
-
- vector<string> List;
-
- for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D))
- {
- if (strcmp(Ent->d_name,".") == 0 ||
- strcmp(Ent->d_name,"..") == 0)
- continue;
-
- // Skip bad extensions
- const char **I;
- for (I = BadExts; *I != 0; I++)
- {
- if (strcmp(Ent->d_name + strlen(Ent->d_name) - strlen(*I),*I) == 0)
- break;
- }
-
- if (*I != 0)
- continue;
-
- // Make sure it is a file and not something else
- string File = flCombine(Dir,Ent->d_name);
- struct stat St;
- if (stat(File.c_str(),&St) != 0 || S_ISREG(St.st_mode) == 0)
- continue;
-
- List.push_back(File);
- }
- closedir(D);
-
- sort(List.begin(),List.end());
+bool ReadConfigDir(Configuration &Conf,const string &Dir,
+ bool const &AsSectional, unsigned const &Depth)
+{
+ vector<string> const List = GetListOfFilesInDir(Dir, "conf", true, true);