- vector<SGPropertyNode_ptr> childNodes = base->getChildren(childname);
- for (int k = (int)childNodes.size() - 1; k >= 0; k--) {
- SGPropertyNode *n = childNodes[k];
- vector<SGPropertyNode_ptr> names = n->getChildren("name");
- if (names.size() ) // && (n->getChildren("axis").size() || n->getChildren("button").size()))
- for (unsigned int j = 0; j < names.size(); j++)
- (*this)[names[j]->getStringValue()] = n;
+SGPropertyNode_ptr
+FGDeviceConfigurationMap::configurationForDeviceName(const std::string& name)
+{
+ NameNodeMap::iterator j = overrideDict.find(name);
+ if (j != overrideDict.end()) {
+ return j->second;
+ }
+
+// no override, check out list of config files
+ NamePathMap::iterator it = namePathMap.find(name);
+ if (it == namePathMap.end()) {
+ return SGPropertyNode_ptr();
+ }
+
+ SGPropertyNode_ptr result(new SGPropertyNode);
+ try {
+ readProperties(it->second.str(), result);
+ result->setStringValue("source", it->second.c_str());
+ } catch (sg_exception&) {
+ SG_LOG(SG_INPUT, SG_WARN, "parse failure reading:" << it->second);
+ return NULL;