#include <plib/pu.h>
#include <plib/ul.h>
+#include <simgear/compiler.h>
#include <simgear/misc/exception.hxx>
#include <Main/fg_props.hxx>
#include "menubar.hxx"
#include "dialog.hxx"
+SG_USING_STD(map);
\f
////////////////////////////////////////////////////////////////////////
ulMakePath(path1, globals->get_fg_root().c_str(), "gui");
ulMakePath(path2, path1, "dialogs");
readDir(path2);
-#if !defined(FG_OLD_MENUBAR)
_menubar->init();
-#endif
}
void
_dialog_props.clear();
}
+static bool
+test_extension (const char * path, const char * ext)
+{
+ int pathlen = strlen(path);
+ int extlen = strlen(ext);
+
+ for (int i = 1; i <= pathlen && i <= extlen; i++) {
+ if (path[pathlen-i] != ext[extlen-i])
+ return false;
+ }
+ return true;
+}
+
void
NewGUI::readDir (const char * path)
{
ulMakePath(subpath, path, dirEnt->d_name);
- if (dirEnt->d_isdir) {
- if (dirEnt->d_name[0] != '.')
- readDir(subpath);
- } else {
+ if (!dirEnt->d_isdir && test_extension(subpath, ".xml")) {
SGPropertyNode * props = new SGPropertyNode;
try {
readProperties(subpath, props);