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".
This commit is contained in:
parent
7ef3bd5f6c
commit
8e659f84fa
1 changed files with 14 additions and 4 deletions
|
@ -140,6 +140,19 @@ NewGUI::clear ()
|
||||||
_dialog_props.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
|
void
|
||||||
NewGUI::readDir (const char * path)
|
NewGUI::readDir (const char * path)
|
||||||
{
|
{
|
||||||
|
@ -159,10 +172,7 @@ NewGUI::readDir (const char * path)
|
||||||
|
|
||||||
ulMakePath(subpath, path, dirEnt->d_name);
|
ulMakePath(subpath, path, dirEnt->d_name);
|
||||||
|
|
||||||
if (dirEnt->d_isdir) {
|
if (!dirEnt->d_isdir && test_extension(subpath, ".xml")) {
|
||||||
if (dirEnt->d_name[0] != '.')
|
|
||||||
readDir(subpath);
|
|
||||||
} else {
|
|
||||||
SGPropertyNode * props = new SGPropertyNode;
|
SGPropertyNode * props = new SGPropertyNode;
|
||||||
try {
|
try {
|
||||||
readProperties(subpath, props);
|
readProperties(subpath, props);
|
||||||
|
|
Loading…
Add table
Reference in a new issue