Make get_XML_Node search for both XML and CTI input file formats
This makes it possible to use species and reactions from external CTI files, rather than only external XML files, since the datasrc extension assumed in the cti->xml conversion is .xml.
This commit is contained in:
parent
f0bb0f8492
commit
5505b791b7
1 changed files with 16 additions and 0 deletions
|
|
@ -231,6 +231,22 @@ XML_Node* get_XML_Node(const std::string& file_ID, XML_Node* root)
|
|||
"no file name given. file_ID = "+file_ID);
|
||||
db = root->findID(idstr, 3);
|
||||
} else {
|
||||
try {
|
||||
findInputFile(fname);
|
||||
} catch (CanteraError& err) {
|
||||
// See if the input file can be found with a different format
|
||||
if (fname.rfind(".xml") == fname.size() - 4) {
|
||||
fname.replace(fname.size() - 3, 3, "cti");
|
||||
} else if (fname.rfind(".cti") == fname.size() - 4) {
|
||||
fname.replace(fname.size() - 3, 3, "xml");
|
||||
}
|
||||
try {
|
||||
findInputFile(fname);
|
||||
} catch (CanteraError& err2) {
|
||||
// rethrow the original error, which indicates the given file name
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
doc = get_XML_File(fname);
|
||||
if (!doc) throw CanteraError("get_XML_Node",
|
||||
"get_XML_File failed trying to open "+fname);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue