From 88dc4db51c2c227a89207104cc0ed43bdf7c6d88 Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 21 Feb 2019 11:57:50 +0300 Subject: [PATCH] Run SALOME with UNICODE path --- src/GEOM/GEOM_Engine.cxx | 15 +++++++++++++-- src/GEOMGUI/GeometryGUI.cxx | 12 ++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/GEOM/GEOM_Engine.cxx b/src/GEOM/GEOM_Engine.cxx index b586ff24b..5e8dff015 100644 --- a/src/GEOM/GEOM_Engine.cxx +++ b/src/GEOM/GEOM_Engine.cxx @@ -512,7 +512,13 @@ bool GEOM_Engine::Save(const char* theFileName) { if(!_document) return false; - _OCAFApp->SaveAs(_document, theFileName); +#if defined(WIN32) && defined(UNICODE) + std::wstring aFileName = Kernel_Utils::utf8_decode_s(theFileName); +#else + std::string aFileName = theFileName; +#endif + + _OCAFApp->SaveAs( _document, aFileName.c_str() ); return true; } @@ -524,8 +530,13 @@ bool GEOM_Engine::Save(const char* theFileName) //============================================================================= bool GEOM_Engine::Load(const char* theFileName) { +#if defined(WIN32) && defined(UNICODE) + std::wstring aFileName = Kernel_Utils::utf8_decode_s(theFileName); +#else + std::string aFileName = theFileName; +#endif Handle(TDocStd_Document) aDoc; - if (_OCAFApp->Open(theFileName, aDoc) != PCDM_RS_OK) { + if (_OCAFApp->Open(aFileName.c_str(), aDoc) != PCDM_RS_OK) { return false; } diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 78a5caa7e..8bc0d966f 100755 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -256,11 +256,11 @@ GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName ) if ( !myGUIMap.contains( libraryName ) ) { // try to load library if it is not loaded yet #if defined(WIN32) - QString dirs = getenv( "PATH" ); + QString dirs = Qtx::getenv( "PATH" ); #elif defined(__APPLE__) - QString dirs = getenv( "DYLD_LIBRARY_PATH" ); + QString dirs = Qtx::getenv( "DYLD_LIBRARY_PATH" ); #else - QString dirs = getenv( "LD_LIBRARY_PATH" ); + QString dirs = Qtx::getenv( "LD_LIBRARY_PATH" ); #endif #if defined(WIN32) QString sep = ";"; @@ -307,11 +307,11 @@ GEOMPluginGUI* GeometryGUI::getPluginLibrary( const QString& libraryName ) // try to load library if it is not loaded yet #if defined(WIN32) - QString dirs = getenv( "PATH" ); + QString dirs = Qtx::getenv( "PATH" ); #elif defined(__APPLE__) - QString dirs = getenv( "DYLD_LIBRARY_PATH" ); + QString dirs = Qtx::getenv( "DYLD_LIBRARY_PATH" ); #else - QString dirs = getenv( "LD_LIBRARY_PATH" ); + QString dirs = Qtx::getenv( "LD_LIBRARY_PATH" ); #endif #if defined(WIN32) QString sep = ";";