throw ArgException(params["include-dir"] + " is not accessible");
}
- std::list<std::string> extraConfigs;
+ std::vector<std::string> extraConfigs;
while((ent = readdir(dir)) != NULL) {
if (ent->d_name[0] == '.') continue; // skip any dots
if (boost::ends_with(ent->d_name, ".conf")) {
extraConfigs.push_back(std::string(namebuf));
}
}
- extraConfigs.sort();
+ std::sort(extraConfigs.begin(), extraConfigs.end(), CIStringComparePOSIX());
BOOST_FOREACH(const std::string& fn, extraConfigs) {
std::cout << "parsing " << fn << std::endl;
if (!file(fn.c_str(), lax, true)) {
}
};
+struct CIStringComparePOSIX
+{
+ bool operator() (const std::string& lhs, const std::string& rhs)
+ {
+ std::string::const_iterator a,b;
+ const std::locale &loc = std::locale("POSIX");
+ a=lhs.begin();b=rhs.begin();
+ while(a!=lhs.end()) {
+ if (b==rhs.end() || std::tolower(*b,loc)<std::tolower(*a,loc)) return false;
+ else if (std::tolower(*a,loc)<std::tolower(*b,loc)) return true;
+ a++;b++;
+ }
+ return (b!=rhs.end());
+ }
+};
+
struct CIStringPairCompare: public std::binary_function<pair<string, uint16_t>, pair<string,uint16_t>, bool>
{
bool operator()(const pair<string, uint16_t>& a, const pair<string, uint16_t>& b) const