]> git.mxchange.org Git - flightgear.git/commitdiff
Merge commit 'refs/merge-requests/9' of git://gitorious.org/fg/flightgear into integr...
authorJames Turner <zakalawe@mac.com>
Mon, 25 Oct 2010 08:12:21 +0000 (09:12 +0100)
committerJames Turner <zakalawe@mac.com>
Mon, 25 Oct 2010 08:12:21 +0000 (09:12 +0100)
Conflicts:
src/GUI/new_gui.cxx

1  2 
src/GUI/new_gui.cxx

index 0e6346f0c709edfb8c32f7975665892221e4a432,51bc82fc9278fd16db8bc77f02e6def9ac0f38e7..5d52b1c1dbb3b306e23b121ecd88a17497ee7661
@@@ -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; i<xmls.size(); ++i) {
 +      SGPropertyNode * props = new SGPropertyNode;
 +      try {
 +          readProperties(xmls[i].str(), props);
 +      } catch (const sg_exception &) {
 +          SG_LOG(SG_INPUT, SG_ALERT, "Error parsing dialog "
 +                 << xmls[i].str());
 +          delete props;
 +          continue;
 +      }
 +      SGPropertyNode *nameprop = props->getNode("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);
  }