Salome HOME
Fix the SHAPER version of resources
authormpv <mpv@opencascade.com>
Wed, 4 May 2016 09:30:31 +0000 (12:30 +0300)
committermpv <mpv@opencascade.com>
Wed, 4 May 2016 09:30:31 +0000 (12:30 +0300)
src/Config/Config_XMLReader.cpp
src/SketcherPrs/SketcherPrs_SymbolPrs.cpp

index 0f36a154867dc7635377ef82d6d840492743a6b1..184fcdf61fa1656a7b395cf0d8ed6c0095f1b82c 100644 (file)
 #include <iostream>
 #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;
 }
 
index ad415c53a5d75abd2f790ef593180e8200620750..590f1abf8e4ebe2603943b0561a34b6556dfa3ef 100644 (file)
@@ -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();