|
a/src/common/rclconfig.cpp |
|
b/src/common/rclconfig.cpp |
|
... |
|
... |
408 |
} else {
|
408 |
} else {
|
409 |
return m_defcharset.empty() ? o_localecharset : m_defcharset;
|
409 |
return m_defcharset.empty() ? o_localecharset : m_defcharset;
|
410 |
}
|
410 |
}
|
411 |
}
|
411 |
}
|
412 |
|
412 |
|
413 |
bool RclConfig::addLocalFields(map<string, string> *tgt) const
|
|
|
414 |
{
|
|
|
415 |
LOGDEB0(("RclConfig::addLocalFields: keydir [%s]\n", m_keydir.c_str()));
|
|
|
416 |
string sfields;
|
|
|
417 |
if (tgt == 0 || ! getConfParam("localfields", sfields))
|
|
|
418 |
return false;
|
|
|
419 |
// Substitute ':' with '\n' inside the string. There is no way to escape ':'
|
|
|
420 |
for (string::size_type i = 0; i < sfields.size(); i++)
|
|
|
421 |
if (sfields[i] == ':')
|
|
|
422 |
sfields[i] = '\n';
|
|
|
423 |
// Parse the result with a confsimple and add the results to the metadata
|
|
|
424 |
ConfSimple conf(sfields, 1, true);
|
|
|
425 |
vector<string> nmlst = conf.getNames(cstr_null);
|
|
|
426 |
for (vector<string>::const_iterator it = nmlst.begin();
|
|
|
427 |
it != nmlst.end(); it++) {
|
|
|
428 |
conf.get(*it, (*tgt)[*it]);
|
|
|
429 |
LOGDEB(("RclConfig::addLocalFields: [%s] => [%s]\n",
|
|
|
430 |
(*it).c_str(), (*tgt)[*it].c_str()));
|
|
|
431 |
}
|
|
|
432 |
return true;
|
|
|
433 |
}
|
|
|
434 |
|
|
|
435 |
// Get all known document mime values. We get them from the mimeconf
|
413 |
// Get all known document mime values. We get them from the mimeconf
|
436 |
// 'index' submap.
|
414 |
// 'index' submap.
|
437 |
// It's quite possible that there are other mime types in the index
|
415 |
// It's quite possible that there are other mime types in the index
|
438 |
// (defined in mimemap and not mimeconf, or output by "file -i"). We
|
416 |
// (defined in mimemap and not mimeconf, or output by "file -i"). We
|
439 |
// just ignore them, because there may be myriads, and their contents
|
417 |
// just ignore them, because there may be myriads, and their contents
|
|
... |
|
... |
628 |
}
|
606 |
}
|
629 |
|
607 |
|
630 |
// Handle additional attributes. We substitute the semi-colons
|
608 |
// Handle additional attributes. We substitute the semi-colons
|
631 |
// with newlines and use a ConfSimple
|
609 |
// with newlines and use a ConfSimple
|
632 |
if (!attrstr.empty()) {
|
610 |
if (!attrstr.empty()) {
|
633 |
for (string::size_type i = 0; i < attrstr.size(); i++)
|
611 |
for (string::size_type i = 0; i < attrstr.size(); i++) {
|
634 |
if (attrstr[i] == ';')
|
612 |
if (attrstr[i] == ';')
|
635 |
attrstr[i] = '\n';
|
613 |
attrstr[i] = '\n';
|
|
|
614 |
}
|
636 |
attrs = ConfSimple(attrstr);
|
615 |
attrs.reparse(attrstr);
|
|
|
616 |
} else {
|
|
|
617 |
attrs.clear();
|
|
|
618 |
}
|
637 |
}
|
619 |
|
638 |
return true;
|
620 |
return true;
|
639 |
}
|
621 |
}
|
640 |
|
|
|
641 |
|
622 |
|
642 |
bool RclConfig::getMissingHelperDesc(string& out) const
|
623 |
bool RclConfig::getMissingHelperDesc(string& out) const
|
643 |
{
|
624 |
{
|
644 |
string fmiss = path_cat(getConfDir(), "missing");
|
625 |
string fmiss = path_cat(getConfDir(), "missing");
|
645 |
out.clear();
|
626 |
out.clear();
|