From 8e659f84fab16382e2ef30183cee657f8c318111 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 24 Jan 2003 02:43:52 +0000 Subject: [PATCH] No longer recursively search $FG_ROOT/gui/dialogs/ for configuration files; all of them must be at the top level. Do not attempt to parse a configuration file unless it ends with ".xml". --- src/GUI/new_gui.cxx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/GUI/new_gui.cxx b/src/GUI/new_gui.cxx index 4e06c320c..d5b86c2fc 100644 --- a/src/GUI/new_gui.cxx +++ b/src/GUI/new_gui.cxx @@ -140,6 +140,19 @@ NewGUI::clear () _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) { @@ -159,10 +172,7 @@ 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);