From: mpv Date: Wed, 4 May 2016 09:01:45 +0000 (+0300) Subject: Fix for the issue #1321 : remove dependency on additional environment variables X-Git-Tag: V_2.3.0~45 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=60a74f80e93d09ce5dce729bfaaba7ec67af8753;p=modules%2Fshaper.git Fix for the issue #1321 : remove dependency on additional environment variables --- diff --git a/CMakeCommon/UnitTest.cmake b/CMakeCommon/UnitTest.cmake index 34cdeba1b..1a69191c0 100644 --- a/CMakeCommon/UnitTest.cmake +++ b/CMakeCommon/UnitTest.cmake @@ -54,10 +54,10 @@ MACRO(ADD_UNIT_TESTS) COMMAND ${PYTHON_EXECUTABLE} ${aTestFileName}) if (WIN32) # different path to libraries variable name SET_TESTS_PROPERTIES(${aTestName} PROPERTIES - ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH};PLUGINS_CONFIG_FILE=${_CONFIG_FILE}") + ENVIRONMENT "PATH=${_JUSTPATH};PYTHONPATH=${_PYTHONPATH}") else() SET_TESTS_PROPERTIES(${aTestName} PROPERTIES - ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH};PLUGINS_CONFIG_FILE=${_CONFIG_FILE}") + ENVIRONMENT "LD_LIBRARY_PATH=${_LD_LIBRARY_PATH};PYTHONPATH=${_PYTHONPATH}") endif() # Debug output... #MESSAGE(STATUS "Test added: ${aTestName} file: ${aTestFileName}") diff --git a/doc/tui/CMakeLists.txt b/doc/tui/CMakeLists.txt index 2c0f54b34..9ff4df7c9 100644 --- a/doc/tui/CMakeLists.txt +++ b/doc/tui/CMakeLists.txt @@ -21,4 +21,5 @@ ADD_CUSTOM_TARGET(dev_docs COMMAND "${CMAKE_COMMAND}" --build "${PROJECT_BINARY_DIR}" --target install --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/doc/tui" ) + INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tui/ DESTINATION ${SHAPER_INSTALL_TUI_DOC} OPTIONAL) diff --git a/env_Salome.bat b/env_Salome.bat index 6b00e790b..980ed7b03 100644 --- a/env_Salome.bat +++ b/env_Salome.bat @@ -99,10 +99,8 @@ IF "%ARCH%" == "Win64" ( ) ) -@SET PLUGINS_CONFIG_FILE=%ROOT_DIR%\install\share\salome\resources\shaper @SET SHAPER_ROOT_DIR=%ROOT_DIR%\install @SET PATH=%SHAPER_ROOT_DIR%\bin\salome;%SHAPER_ROOT_DIR%\lib\salome;%PATH% @SET PYTHONPATH=%SHAPER_ROOT_DIR%\bin\salome;%SHAPER_ROOT_DIR%\lib\salome;%PYTHONPATH% @SET LightAppConfig=%SHAPER_ROOT_DIR%\share\salome\resources\shaper;%GUI_ROOT_DIR%\share\salome\resources\gui -@SET SHAPERResources=%SHAPER_ROOT_DIR%\share\salome\resources\shaper diff --git a/env_linux.sh b/env_linux.sh index d7f2e2f72..c376a2059 100644 --- a/env_linux.sh +++ b/env_linux.sh @@ -55,5 +55,3 @@ export PATH=${CASROOT}:${PATH} export PATH=${SHAPER_ROOT_DIR}/bin/salome:${SHAPER_ROOT_DIR}/lib/salome:${PATH} export PYTHONPATH=${SHAPER_ROOT_DIR}//bin/salome:${SHAPER_ROOT_DIR}/lib/salome:${PYTHONPATH} export LD_LIBRARY_PATH=${SHAPER_ROOT_DIR}/bin/salome:${SHAPER_ROOT_DIR}/lib/salome:${LD_LIBRARY_PATH} -export PLUGINS_CONFIG_FILE=${SHAPER_ROOT_DIR}/share/salome/resources/shaper -export SHAPERResources=${SHAPER_ROOT_DIR}/share/salome/resources/shaper diff --git a/src/Config/Config_XMLReader.cpp b/src/Config/Config_XMLReader.cpp index 11b2c5890..0f36a1548 100644 --- a/src/Config/Config_XMLReader.cpp +++ b/src/Config/Config_XMLReader.cpp @@ -62,10 +62,20 @@ Config_XMLReader::~Config_XMLReader() std::string Config_XMLReader::pluginConfigFile() { std::string aValue; - char* anEnv = getenv("PLUGINS_CONFIG_FILE"); + char* anEnv = getenv("SHAPER_ROOT_DIR"); if (anEnv) { aValue = std::string(anEnv); + } else { + anEnv = getenv("OPENPARTS_ROOT_DIR"); + if (anEnv) + aValue = std::string(anEnv); } +#ifdef WIN32 + aValue += "\\"; +#else + aValue += "/"; +#endif + aValue += "plugins"; return aValue; } diff --git a/src/Config/Config_XMLReader.h b/src/Config/Config_XMLReader.h index c983e3a49..62173af31 100644 --- a/src/Config/Config_XMLReader.h +++ b/src/Config/Config_XMLReader.h @@ -44,7 +44,7 @@ class Config_XMLReader CONFIG_EXPORT Config_XMLReader(const std::string& theXmlFile); CONFIG_EXPORT virtual ~Config_XMLReader(); /*! - * Returns value of PLUGINS_CONFIG_FILE env variable, a path to the plugins.xml file + * Returns a path to the plugins.xml file (created from ROOT_DIR environment variable) * \return string value */ CONFIG_EXPORT static std::string pluginConfigFile(); diff --git a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp index 73c43f717..ad415c53a 100644 --- a/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp +++ b/src/SketcherPrs/SketcherPrs_SymbolPrs.cpp @@ -273,16 +273,24 @@ Handle(Image_AlienPixMap) SketcherPrs_SymbolPrs::icon() return myIconsMap[iconName()]; } // Load icon for the presentation - char* aEnv = getenv("SHAPERResources"); - if (aEnv != NULL) { - TCollection_AsciiString aFile(aEnv); - aFile += FSEP; - aFile += iconName(); - Handle(Image_AlienPixMap) aPixMap = new Image_AlienPixMap(); - if (aPixMap->Load(aFile)) { - myIconsMap[iconName()] = aPixMap; - return aPixMap; - } + std::string aFile; + char* anEnv = getenv("SHAPER_ROOT_DIR"); + if (anEnv) { + aFile = std::string(anEnv); + } else { + anEnv = getenv("OPENPARTS_ROOT_DIR"); + if (anEnv) + aFile = std::string(anEnv); + } + aFile += FSEP; + aFile += "resources"; + + aFile += FSEP; + aFile += iconName(); + Handle(Image_AlienPixMap) aPixMap = new Image_AlienPixMap(); + if (aPixMap->Load(aFile.c_str())) { + myIconsMap[iconName()] = aPixMap; + return aPixMap; } // The icon for constraint is not found static const char aMsg[] = "Error! constraint images are not found";