From c695a96b97d29fef995466f2ff5bbd4eb7f87364 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 4 May 2016 12:30:31 +0300 Subject: [PATCH] Fix the SHAPER version of resources --- src/Config/Config_XMLReader.cpp | 27 ++++++++++------------- src/SketcherPrs/SketcherPrs_SymbolPrs.cpp | 7 +++--- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/Config/Config_XMLReader.cpp b/src/Config/Config_XMLReader.cpp index 0f36a1548..184fcdf61 100644 --- a/src/Config/Config_XMLReader.cpp +++ b/src/Config/Config_XMLReader.cpp @@ -27,6 +27,12 @@ #include #endif +#ifdef WIN32 + static const char FSEP = '\\'; +#else + static const char FSEP = '/'; +#endif + Config_XMLReader::Config_XMLReader(const std::string& theXmlFileName) : myXmlDoc(NULL) { @@ -43,12 +49,7 @@ Config_XMLReader::Config_XMLReader(const std::string& theXmlFileName) if (prefix.empty()) prefix = pluginConfigFile(); -#ifdef WIN32 - prefix += "\\"; -#else - prefix += "/"; -#endif - myDocumentPath = prefix + theXmlFileName; + myDocumentPath = prefix + FSEP + theXmlFileName; std::ifstream aTestFile(myDocumentPath); if (!aTestFile) Events_Error::send("Unable to open " + myDocumentPath); aTestFile.close(); @@ -64,18 +65,14 @@ std::string Config_XMLReader::pluginConfigFile() std::string aValue; char* anEnv = getenv("SHAPER_ROOT_DIR"); if (anEnv) { - aValue = std::string(anEnv); + aValue = std::string(anEnv) + + FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper"; } else { anEnv = getenv("OPENPARTS_ROOT_DIR"); - if (anEnv) - aValue = std::string(anEnv); + if (anEnv) { + aValue = std::string(anEnv) + FSEP + "plugins"; + } } -#ifdef WIN32 - aValue += "\\"; -#else - aValue += "/"; -#endif - aValue += "plugins"; return aValue; } diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index ad415c53a..590f1abf8 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -276,14 +276,13 @@ Handle(Image_AlienPixMap) SketcherPrs_SymbolPrs::icon() std::string aFile; char* anEnv = getenv("SHAPER_ROOT_DIR"); if (anEnv) { - aFile = std::string(anEnv); + aFile = std::string(anEnv) + + FSEP + "share" + FSEP + "salome" + FSEP + "resources" + FSEP + "shaper"; } else { anEnv = getenv("OPENPARTS_ROOT_DIR"); if (anEnv) - aFile = std::string(anEnv); + aFile = std::string(anEnv) + FSEP + "resources"; } - aFile += FSEP; - aFile += "resources"; aFile += FSEP; aFile += iconName(); -- 2.39.2