From: James Turner Date: Mon, 25 Oct 2010 08:12:21 +0000 (+0100) Subject: Merge commit 'refs/merge-requests/9' of git://gitorious.org/fg/flightgear into integr... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e5abcb1d4ebc987cce695df854465c0b6563f994;p=flightgear.git Merge commit 'refs/merge-requests/9' of git://gitorious.org/fg/flightgear into integration/merge9 Conflicts: src/GUI/new_gui.cxx --- e5abcb1d4ebc987cce695df854465c0b6563f994 diff --cc src/GUI/new_gui.cxx index 0e6346f0c,51bc82fc9..5d52b1c1d --- a/src/GUI/new_gui.cxx +++ b/src/GUI/new_gui.cxx @@@ -243,34 -260,46 +243,31 @@@ NewGUI::newDialog (SGPropertyNode* prop } void -NewGUI::readDir (const char * path) +NewGUI::readDir (const SGPath& path) { - ulDir * dir = ulOpenDir(path); - - if (dir == 0) { - SG_LOG(SG_GENERAL, SG_ALERT, "Failed to read GUI files from " - << path); - return; - } - - for (ulDirEnt * dirEnt = ulReadDir(dir); - dirEnt != 0; - dirEnt = ulReadDir(dir)) { - - char subpath[1024]; - - ulMakePath(subpath, path, dirEnt->d_name); - - if (!dirEnt->d_isdir && test_extension(subpath, ".xml")) { - SGPropertyNode * props = new SGPropertyNode; - try { - readProperties(subpath, props); - } catch (const sg_exception &) { - SG_LOG(SG_INPUT, SG_ALERT, "Error parsing dialog " - << subpath); - delete props; - continue; - } - SGPropertyNode *nameprop = props->getNode("name"); - if (!nameprop) { - SG_LOG(SG_INPUT, SG_WARN, "dialog " << subpath - << " has no name; skipping."); - delete props; - continue; - } - string name = nameprop->getStringValue(); - _dialog_props[name] = props; - } + simgear::Dir dir(path); + simgear::PathList xmls = dir.children(simgear::Dir::TYPE_FILE, ".xml"); + + for (unsigned int i=0; igetNode("name"); + if (!nameprop) { + SG_LOG(SG_INPUT, SG_WARN, "dialog " << xmls[i].str() + << " has no name; skipping."); + delete props; + continue; + } + string name = nameprop->getStringValue(); - if (_dialog_props[name]) - delete (SGPropertyNode *)_dialog_props[name]; - + _dialog_props[name] = props; } - ulCloseDir(dir); }