X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_XMLReader.cpp;h=b98f072502d64574c09aae8ab4437e61387ac9a8;hb=2cb4458b35ae6c9561a35b3b18dbdb673d0c12c9;hp=1d7de9c6badf7991aa510e618bec1af51394e483;hpb=97917d3698f5a2f7fc9596e7c755ff8f6751e373;p=modules%2Fshaper.git diff --git a/src/Config/Config_XMLReader.cpp b/src/Config/Config_XMLReader.cpp index 1d7de9c6b..b98f07250 100644 --- a/src/Config/Config_XMLReader.cpp +++ b/src/Config/Config_XMLReader.cpp @@ -45,12 +45,15 @@ 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(); + } } } @@ -68,7 +71,7 @@ std::string Config_XMLReader::resourcesConfigFile() 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"; } @@ -84,7 +87,7 @@ std::string Config_XMLReader::pluginConfigFile() 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"; } @@ -108,9 +111,9 @@ std::string Config_XMLReader::findConfigFile(const std::string theFileName, cons 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) @@ -148,7 +151,7 @@ std::string Config_XMLReader::findConfigFile(const std::string theFileName, cons 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++; } } @@ -157,6 +160,13 @@ std::string Config_XMLReader::findConfigFile(const std::string theFileName, cons 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);