From: david Date: Mon, 11 Nov 2002 14:40:16 +0000 (+0000) Subject: Allow 'include' attribute on root PropertyList element. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3af4a19f76fdb01a703a571027b03093b5cd6654;p=simgear.git Allow 'include' attribute on root PropertyList element. --- diff --git a/simgear/misc/props_io.cxx b/simgear/misc/props_io.cxx index 45f88296..15c522be 100644 --- a/simgear/misc/props_io.cxx +++ b/simgear/misc/props_io.cxx @@ -140,6 +140,7 @@ void PropsVisitor::startElement (const char * name, const XMLAttributes &atts) { State &st = state(); + const char * attval; if (_level == 0) { if (string(name) != (string)"PropertyList") { @@ -148,12 +149,23 @@ PropsVisitor::startElement (const char * name, const XMLAttributes &atts) message += "; expected PropertyList"; throw sg_io_exception(message, "SimGear Property Reader"); } + + // Check for an include. + attval = atts.getValue("include"); + if (attval != 0) { + SGPath path(SGPath(_base).dir()); + path.append(attval); + try { + readProperties(path.str(), _root); + } catch (sg_io_exception &e) { + setException(e); + } + } + push_state(_root, "", DEFAULT_MODE); } else { - - const char * attval; // Get the index. attval = atts.getValue("n"); int index = 0;