-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
static const char FSEP = '/';
#endif
-Config_XMLReader::Config_XMLReader(const std::string& theXmlFileName)
+Config_XMLReader::Config_XMLReader(const std::string& theXmlFileName, bool isXMLContent)
: myXmlDoc(NULL), myRootFileName(theXmlFileName)
{
- myDocumentPath = findConfigFile(theXmlFileName);
- if (myDocumentPath.empty()) {
- Events_InfoMessage("Config_XMLReader", "Unable to open %1").arg(theXmlFileName).send();
+ isFromMemory = isXMLContent;
+ if (!isXMLContent) {
+ myDocumentPath = findConfigFile(theXmlFileName);
+ if (myDocumentPath.empty()) {
+ Events_InfoMessage("Config_XMLReader", "Unable to open %1").arg(theXmlFileName).send();
+ }
}
}
aValue = std::string(anEnv) +
FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper";
} else {
- anEnv = getenv("OPENPARTS_ROOT_DIR");
+ anEnv = getenv("CADBUILDER_ROOT_DIR");
if (anEnv) {
aValue = std::string(anEnv) + FSEP + "resources";
}
aValue = std::string(anEnv) +
FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper";
} else {
- anEnv = getenv("OPENPARTS_ROOT_DIR");
+ anEnv = getenv("CADBUILDER_ROOT_DIR");
if (anEnv) {
aValue = std::string(anEnv) + FSEP + "plugins";
}
if (aSolution == 1)
anEnvName<<"SHAPER_ROOT_DIR";
else if (aSolution == 2)
- anEnvName<<"OPENPARTS_ROOT_DIR";
+ anEnvName<<"CADBUILDER_ROOT_DIR";
else
- anEnvName<<"OPENPARTS_PLUGINS_DIR";
+ anEnvName<<"CADBUILDER_ROOT_DIR";
char* anEnv = getenv(anEnvName.str().c_str());
if (!anEnv)
if (aResultIndex == theFindIndex)
return aFileName;
aResultIndex++;
- if (aSolution == 1) // don't allow SHAPER and OpenParts paths treated simultaneously
+ if (aSolution == 1) // don't allow SHAPER and CADBuilder paths treated simultaneously
aSolution++;
}
}
void Config_XMLReader::readAll()
{
+ if (isFromMemory) {
+ myXmlDoc = xmlParseMemory(myRootFileName.c_str(), myRootFileName.length());
+ xmlNodePtr aRoot = xmlDocGetRootElement(myXmlDoc);
+ readRecursively(aRoot);
+ return;
+ }
+
// to load external modules dependencies (like GEOM for Connector Feature)
Config_ModuleReader::loadScript("salome.shaper.initConfig", false);