Salome HOME
Run SALOME with UNICODE path.
authorrnv <rnv@opencascade.com>
Thu, 21 Feb 2019 08:46:02 +0000 (11:46 +0300)
committerrnv <rnv@opencascade.com>
Mon, 11 Mar 2019 09:56:51 +0000 (12:56 +0300)
19 files changed:
src/GLViewer/GLViewer_Widget.cxx
src/HelpBrowser/CMakeLists.txt
src/HelpBrowser/HelpBrowser.cxx
src/HelpBrowser/HelpBrowser.qrc
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Driver.cxx
src/PVViewer/PVViewer_Core.cxx
src/PVViewer/PVViewer_ViewManager.cxx
src/Qtx/Qtx.cxx
src/Qtx/Qtx.h
src/Qtx/QtxResourceMgr.cxx
src/SUIT/SUIT_LicenseDlg.cxx
src/SVTK/SVTK_RecorderDlg.cxx
src/Session/SALOME_Session_Server.cxx
src/Style/Style_ResourceMgr.cxx
src/TOOLSGUI/ToolsGUI_CatalogGeneratorDlg.cxx
src/VTKViewer/VTKViewer_OpenGLHelper.cxx
src/VTKViewer/VTKViewer_OpenGLRenderer.cxx
src/VTKViewer/VTKViewer_PolyDataMapper.cxx

index e402bf849a063507e2fc55f873afbbf9809001a6..8fabfd1ddade7c4c3277495af14a57d055274610 100644 (file)
@@ -265,7 +265,7 @@ void GLViewer_Widget::initializeGL()
     
     //get image
     QImage buf; 
-    QString aPicturePath = getenv("GLViewer__Background_Picture");
+    QString aPicturePath = Qtx::getenv("GLViewer__Background_Picture");
     
     if ( !aPicturePath.isEmpty() && buf.load( aPicturePath ) ) 
     {  // Load first image from file
index d17f18cfdcb5d20d37ebaa2a1dfd33d1e1862ee0..ca8d71c261a33eb52a8693e17da2aaefd723bdeb 100644 (file)
@@ -79,3 +79,4 @@ SET(HelpBrowser_SOURCES
 ADD_EXECUTABLE(HelpBrowser ${HelpBrowser_SOURCES})
 TARGET_LINK_LIBRARIES(HelpBrowser ${_link_LIBRARIES})
 INSTALL(TARGETS HelpBrowser EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_BINS})
+INSTALL(FILES qt.conf DESTINATION ${SALOME_INSTALL_BINS})
index e737aa0292f7f85ed8e14f7fbb05af523e171ece..72023e1f6f1b541961b62d105c552a5a81e8bf1f 100644 (file)
 
 #include <iostream>
 
+#ifdef WIN32
+#include <windows.h>
+#endif
+
+
 namespace
 {
   void printHelp()
@@ -152,6 +157,16 @@ int main( int argc, char **argv )
     }
   }
 
+#if defined(WIN32) && defined(UNICODE)                   
+  LPWSTR *szArglist = NULL;
+  int nArgs;
+  int i;
+  szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);         
+  helpfile = QString::fromWCharArray(szArglist[nArgs-1]);
+  // Free memory allocated for CommandLineToArgvW arguments.
+  LocalFree(szArglist);
+#endif
+
   // Show help and exit if '--help' or '-h' option has been specified via command line
   if ( showHelp )
   {
@@ -262,7 +277,7 @@ int main( int argc, char **argv )
 
   // Load file specified via command line
   if ( helpfile.isEmpty() ) {
-    QString docdir = qgetenv( "DOCUMENTATION_ROOT_DIR" );
+    QString docdir = Qtx::getenv( "DOCUMENTATION_ROOT_DIR" );
     if ( !docdir.isEmpty() )
       helpfile = QDir::toNativeSeparators( QString( "%1/index.html" ).arg( docdir ) );
   }
index 6fde5583534ddbb072fde5207ffeb2c42316fc91..d5aca33714eb94191792b5f44dfc0e563f94d9f2 100644 (file)
@@ -1,6 +1,5 @@
 <!DOCTYPE RCC><RCC version="1.0">
 <qresource>
   <file>COPYING</file>
-  <file alias="qt/etc/qt.conf">qt.conf</file>
 </qresource>
 </RCC>
index 106f4c04dad5423a5bbf78808ec5c8d873688a2c..c084037b20ec770da1067198313e99c77f81de91 100644 (file)
@@ -659,7 +659,7 @@ void LightApp_Application::createActions()
     QString modName = moduleName( aModule );                         // module name
     if ( modName.isEmpty() ) modName = aModule;                      // for KERNEL and GUI
     QString rootDir = QString( "%1_ROOT_DIR" ).arg( modName );       // module root dir env variable
-    QString modDir  = getenv( rootDir.toUtf8().constData() );        // module root dir path
+    QString modDir  = Qtx::getenv( rootDir.toUtf8().constData() );        // module root dir path
     QString docSection;
     if (resMgr->hasValue( modName, "documentation" ) )
       docSection = resMgr->stringValue(modName, "documentation");
@@ -1283,7 +1283,7 @@ void LightApp_Application::onHelpContextModule( const QString& component,
     QFileInfo fi( url );
     if ( fi.isRelative() && !component.isEmpty() )
     {
-      QString rootDir = getenv( (component + "_ROOT_DIR").toLatin1().constData() );
+      QString rootDir = Qtx::getenv( (component + "_ROOT_DIR").toLatin1().constData() );
       if ( !rootDir.isEmpty() )
       {
        path = (QStringList() << rootDir << "share" << "doc" << "salome" << "gui" << component << url).join( QDir::separator() );
@@ -3969,11 +3969,11 @@ bool LightApp_Application::checkModule( const QString& title )
 
   QStringList paths;
 #if defined(WIN32)
-  paths = QString( ::getenv( "PATH" ) ).split( ";", QString::SkipEmptyParts );
+  paths = QString( Qtx::getenv( "PATH" ) ).split( ";", QString::SkipEmptyParts );
 #elif defined(__APPLE__)
-  paths = QString( ::getenv( "DYLD_LIBRARY_PATH" ) ).split( ":", QString::SkipEmptyParts );
+  paths = QString( Qtx::getenv( "DYLD_LIBRARY_PATH" ) ).split( ":", QString::SkipEmptyParts );
 #else
-  paths = QString( ::getenv( "LD_LIBRARY_PATH" ) ).split( ":", QString::SkipEmptyParts );
+  paths = QString( Qtx::getenv( "LD_LIBRARY_PATH" ) ).split( ":", QString::SkipEmptyParts );
 #endif
 
   bool isFound = false;
index 7b8d79807f36530471a27b268900713625b4370d..fe8fc099d68a240058122c7af24e995736c6fa82 100644 (file)
@@ -33,6 +33,8 @@
 #include <QFileInfo>
 #include <QDir>
 
+#include <Qtx.h>
+
 #ifdef WIN32
 #include <time.h>
 #endif
index e629e392b93ec68012096f863551567b581e461a..e59820f0d5ce24b4c57b3520ffa22de8e6c87b8a 100644 (file)
@@ -25,6 +25,8 @@
 #include "PVViewer_Behaviors.h"
 #include "PVViewer_Core.h"
 
+#include <Qtx.h>
+
 #include <QApplication>
 #include <QStringList>
 #include <QDir>
@@ -64,7 +66,7 @@ bool PVViewer_Core::ParaviewInitApp(QMainWindow * aDesktop)
       // Obtain command-line arguments
       int argc = 0;
       char** argv = 0;
-      QString aOptions = getenv("PARAVIEW_OPTIONS");
+      QString aOptions = Qtx::getenv("PARAVIEW_OPTIONS");
       QStringList aOptList = aOptions.split(":", QString::SkipEmptyParts);
       argv = new char*[aOptList.size() + 4]; // add one, MPI requires argv[argc] = 0!
       for (int i =0; i< aOptList.size() + 4; i++)
index d4a7a19536a5c5fa84dee84ddde705fa8bbd91e5..a9b283ceb8928a2d546cc5ee7c785fe7139c2a50 100644 (file)
@@ -95,7 +95,7 @@ bool PVViewer_ViewManager::ConnectToExternalPVServer(QMainWindow* desktop)
   std::stringstream msg;
 
   // Try to connect to the external PVServer - gives priority to an externally specified URL:
-  QString serverUrlEnv = getenv("PARAVIEW_PVSERVER_URL");
+  QString serverUrlEnv = Qtx::getenv("PARAVIEW_PVSERVER_URL");
   std::string serverUrl;
   if (!serverUrlEnv.isEmpty())
   {
index 2cfdeca70dfbac734df19cdafee7653eee01734b..30fda906e62bc9e4125ab6e9346169f666406fe2 100644 (file)
 #include <stdarg.h>
 #include <clocale>
 
+#ifdef WIN32
+#include <windows.h>
+#define MAX_VALUE_SIZE 32767 // Limit according to http://msdn.microsoft.com/en-us/library/ms683188.aspx
+#endif
+
+#include <iostream>
+
 #define BICOLOR_CHANGE_HUE
 
 /*!
@@ -484,18 +491,18 @@ QString Qtx::library( const QString& str )
 */
 QString Qtx::tmpDir()
 {
-  const char* tmpdir = ::getenv( "TEMP" );
-  if ( !tmpdir )
-    tmpdir = ::getenv ( "TMP" );
-  if ( !tmpdir )
+  QString tmpdir = getenv( "TEMP" );
+  if ( tmpdir.isEmpty() )
+    tmpdir = getenv ( "TMP" );
+  if ( tmpdir.isEmpty() )
   {
 #ifdef WIN32
-    tmpdir = "C:\\";
+    tmpdir = QString("C:\\");
 #else
-    tmpdir = "/tmp";
+    tmpdir = QString("/tmp");
 #endif
   }
-  return QString( tmpdir );
+  return tmpdir;
 }
 
 /*!
@@ -746,8 +753,8 @@ QString Qtx::makeEnvVarSubst( const QString& str, const SubstMode mode )
         break;
 
       QString newStr;
-      if ( ::getenv( envName.toUtf8() ) || mode == Always )
-        newStr = QString( ::getenv( envName.toUtf8() ) );
+      if ( getenv( envName ).isEmpty() || mode == Always )
+        newStr = QString( getenv( envName ) );
 
       if ( newStr.isNull() )
       {
@@ -2113,10 +2120,12 @@ long Qtx::versionToId( const QString& version )
 
 QString Qtx::qtDir( const QString& context )
 {
-  const char* vars[] = { "QT5_ROOT_DIR", "QT4_ROOT_DIR", "QT_ROOT_DIR", "QTDIR" };
+
+  QStringList vars = { "QT5_ROOT_DIR", "QT4_ROOT_DIR", "QT_ROOT_DIR", "QTDIR" };
   QString qtPath;
-  for (uint i = 0; i < sizeof(vars)/sizeof(vars[0]) && qtPath.isEmpty(); i++ )
-    qtPath = qgetenv( vars[i] );
+  for (uint i = 0; i < vars.length() && qtPath.isEmpty(); i++ ) {
+    qtPath = getenv(vars[i]);
+  }
   if ( !qtPath.isEmpty() && !context.isEmpty() )
     qtPath = QDir( qtPath ).absoluteFilePath( context );
   return qtPath;
@@ -2133,6 +2142,36 @@ QFont Qtx::stringToFont( const QString& fontDescription )
   return font;
 }
 
+QString Qtx::getenv(const QString & envVar)
+{
+       QString value;
+#ifndef WIN32
+       value = qgetenv(envVar.toLocal8Bit().constData());
+#else
+       LPTSTR buff = new TCHAR[MAX_VALUE_SIZE];
+#ifdef UNICODE
+       LPTSTR anEnvVar = new TCHAR[envVar.length() + 1];       
+       anEnvVar[envVar.toWCharArray(anEnvVar)] = '\0';
+#else
+       const TCHAR* anEnvVar = envVar.toLocal8Bit(buff).constData();
+#endif 
+       const DWORD ret = GetEnvironmentVariable(anEnvVar, buff, MAX_VALUE_SIZE);
+       buff[ret] = '\0';
+       if (ret > 0) {
+#ifdef UNICODE
+               value = QString::fromWCharArray(buff);
+#else
+               value = QString::fromLocal8Bit(buff);
+#endif 
+       }
+       delete buff;
+#ifdef UNICODE
+       delete anEnvVar;
+#endif
+#endif
+       return value;
+}
+
 #if !defined WIN32 && !defined __APPLE__ 
 
 #include <X11/Xlib.h>
index b0d1081491b7057d7ecd7af14287fa017169e4ee..25d4010c80604f45491a8645d41c9a8451710dea 100644 (file)
@@ -279,6 +279,8 @@ public:
 
   static QFont   stringToFont( const QString& fontDescription );
 
+  static QString     getenv( const QString& envVar );
+
 #ifndef WIN32
   static void*       getDisplay();
   static Qt::HANDLE  getVisual();
index a88923ad23d10eea4ab6fe3765d29ad283c25252..4fa61bf0f617506f1ac166cca566bcd46b953f11 100644 (file)
@@ -462,8 +462,9 @@ QString QtxResourceMgr::Resources::makeSubstitution( const QString& str, const Q
     QString newStr = constants.value( envName, QString() );
 
     // Then we check for environment variable
-    if ( newStr.isEmpty() && ::getenv( envName.toLatin1() ) )
-      newStr = QString( ::getenv( envName.toLatin1() ) );
+       QString tmpValue = Qtx::getenv( envName );
+    if ( newStr.isEmpty() && !tmpValue.isEmpty() )
+      newStr = tmpValue;
 
     if ( newStr.isEmpty() )
     {
@@ -1251,8 +1252,9 @@ QtxResourceMgr::QtxResourceMgr( const QString& appName, const QString& resVarTem
     envVar = envVar.arg( appName );
 
   QString dirs;
-  if ( ::getenv( envVar.toLatin1() ) )
-    dirs = ::getenv( envVar.toLatin1() );
+  QString tmpValue = Qtx::getenv( envVar );
+  if ( !tmpValue.isEmpty() )
+    dirs = tmpValue;
 #ifdef WIN32
   QString dirsep = ";";      // for Windows: ";" is used as directories separator
 #else
index 166dd66c9728d1d007a43827e3cc5255cdc8c0b5..efd266adc72e5b20157b5fccc5dc12f2b0bc49ec 100644 (file)
@@ -32,6 +32,8 @@
 
 #include <math.h>
 
+#include <Qtx.h>
+
 #ifdef WIN32
 #include <UserEnv.h>
 #endif
@@ -47,10 +49,7 @@ SUIT_LicenseDlg::SUIT_LicenseDlg( bool firstShow, QWidget* parent, const char* n
 {
   setObjectName( name );
   setModal( modal );
-  QString env;
-  if ( ::getenv( "SALOME_LICENSE_FILE" ) )
-    env = ::getenv( "SALOME_LICENSE_FILE" );
+  QString env = Qtx::getenv( "SALOME_LICENSE_FILE" ); 
   QFile file( env ); // Read the text from a file
   
   if ( !file.exists() || !file.open( QIODevice::ReadOnly ) )
index d01dbe362c53b3fb957a9771e8cb06b3a4866967..b8816ad77eda3ad372a422055bdc8670677f70aa 100644 (file)
@@ -25,6 +25,8 @@
 #include <SUIT_ResourceMgr.h>
 #include <SUIT_Session.h>
 
+#include <Qtx.h>
+
 #include <QtxDoubleSpinBox.h>
 #include <QtxIntSpinBox.h>
 
@@ -173,7 +175,7 @@ bool SVTK_RecorderDlg::onBrowseFile()
   aFilter.append( tr( "FLT_AVI_FILES" ) );
   aFilter.append( tr( "FLT_ALL_FILES" ) );
 
-  QString aFileName = SUIT_FileDlg::getFileName( this, getenv( "HOME" ), aFilter,
+  QString aFileName = SUIT_FileDlg::getFileName( this, Qtx::getenv( "HOME" ), aFilter,
                                                  tr( "FILE_NAME" ), false );
 
   if( aFileName.isNull() )
index 82481ceaf2dd9f04d5e7273c06d1186631921158..a8e0b7e8bcc704798987234c8d9ff9a43b3c4ff8 100644 (file)
@@ -67,6 +67,9 @@
 
 #ifdef WIN32
 #define sleep _sleep
+#include <windows.h>
+#include <stdio.h>
+#include <shellapi.h>
 #endif
 
 #include <time.h>
@@ -79,6 +82,8 @@
 #include <QRegExp>
 #include <QTextStream>
 
+#include <Basics_Utils.hxx> 
+
 /*! - read arguments, define list of server to launch with their arguments.
  * - wait for naming service
  * - create and run a thread for launch of all servers
@@ -397,7 +402,7 @@ int main( int argc, char **argv )
   _qappl.setApplicationVersion( salomeVersion() );
 
   // Add application library path (to search style plugin etc...)
-  QString path = QDir::toNativeSeparators( SUIT_Tools::addSlash( QString( ::getenv( "GUI_ROOT_DIR" ) ) ) + QString( "bin/salome" ) );
+  QString path = QDir::toNativeSeparators( SUIT_Tools::addSlash( QString( Qtx::getenv( "GUI_ROOT_DIR" ) ) ) + QString( "bin/salome" ) );
   _qappl.addLibraryPath( path );
 
   bool isGUI    = isFound( "GUI",    argc, argv );
@@ -442,7 +447,9 @@ int main( int argc, char **argv )
   SALOME_NamingService* _NS = 0;
   GetInterfaceThread* guiThread = 0;
   Session_ServerLauncher* myServerLauncher = 0;
-
+#if defined(WIN32) && defined(UNICODE)
+  char** new_argv = NULL;
+#endif
   try {
     // ...initialize Python (only once)
     int   _argc   = 1;
@@ -499,7 +506,21 @@ int main( int argc, char **argv )
     // ...lock mutex to block embedded servers launching thread until wait( mutex )
     _GUIMutex.lock();  
     // ...create launcher
+#if defined(WIN32) && defined(UNICODE)
+       LPWSTR *szArglist = NULL;
+       int nArgs;
+       int i;
+       szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);      
+       new_argv = new char*[nArgs];
+       for (i = 0; i < nArgs; i++) {
+               new_argv[i] = (char*) Kernel_Utils::utf8_encode(szArglist[i]);
+       }
+       // Free memory allocated for CommandLineToArgvW arguments.
+       LocalFree(szArglist);
+       myServerLauncher = new Session_ServerLauncher(nArgs, new_argv, orb, poa, &_GUIMutex, &_ServerLaunch, &_SessionMutex, &_SessionStarted); 
+#else
     myServerLauncher = new Session_ServerLauncher( argc, argv, orb, poa, &_GUIMutex, &_ServerLaunch, &_SessionMutex, &_SessionStarted );
+#endif
     // ...block this thread until launcher is ready
     _ServerLaunch.wait( &_GUIMutex );
     
@@ -656,6 +677,9 @@ int main( int argc, char **argv )
   delete guiThread;
   delete myServerLauncher;
   delete _NS;
+#if defined(WIN32) && defined(UNICODE)
+  delete[] new_argv;
+#endif
 
   try  {
     orb->shutdown(0);
index 54480c0662e9093b4d8ce21c68abe93d7750766d..8ef1f897c18786e08f9fb4b23a201d8f851951af 100644 (file)
@@ -43,8 +43,9 @@
 Style_ResourceMgr::Style_ResourceMgr()
   : QtxResourceMgr( "SalomeStyle", "%1Config" )
 {
-  if ( dirList().isEmpty() && ::getenv( "GUI_ROOT_DIR" ) )
-    setDirList( QStringList() << Qtx::addSlash( ::getenv( "GUI_ROOT_DIR" ) ) + "share/salome/resources/gui" );
+  QString gui_root = Qtx::getenv( "GUI_ROOT_DIR" );
+  if ( dirList().isEmpty() && !gui_root.isEmpty() )
+    setDirList( QStringList() << Qtx::addSlash( gui_root ) + "share/salome/resources/gui" );
   setCurrentFormat( "xml" );
 }
 
index 615a945379ef3def34a0f94ded04efbb06d5c031..fa216da4e42784188f11ad8db30254a3a3658e22 100644 (file)
@@ -43,6 +43,8 @@
 #include <QIntValidator>
 #include <QFile>
 
+#include <Qtx.h>
+
 #include <OSD_Process.hxx>
 #include <OSD_Path.hxx>
 #include <TCollection_AsciiString.hxx>
@@ -399,8 +401,9 @@ void ToolsGUI_CatalogGeneratorDlg::onApply()
     }
     else {
       QString command = "";
-      if ( getenv("KERNEL_ROOT_DIR")  )
-        command = QString( getenv( "KERNEL_ROOT_DIR" ) ) + "/bin/salome/runIDLparser -K " + IDLpath + " -Wbcatalog=" + XmlFile;
+      QString kernel_root = Qtx::getenv("KERNEL_ROOT_DIR"); 
+      if ( !kernel_root.isEmpty() )
+        command = kernel_root + "/bin/salome/runIDLparser -K " + IDLpath + " -Wbcatalog=" + XmlFile;
       else {
         SUIT_MessageBox::critical( this, 
                                    tr("TOOLS_ERR_ERROR"), 
index dec97b0ee14863e37fcfd5bb6be9313518e9cbaf..fe9ae203a6881aca677671e805c9c477654ca512 100644 (file)
@@ -22,6 +22,7 @@
 
 
 #include "VTKViewer_OpenGLHelper.h"
+#include <Basics_Utils.hxx>
 
 #ifndef WIN32
 # ifndef GLX_GLXEXT_LEGACY
@@ -219,8 +220,12 @@ namespace GUI_OPENGL
 {
        char* readFromFile( std::string fileName )
        {
+#if defined(WIN32) && defined(UNICODE)
+         const wchar_t* wFileName = Kernel_Utils::utf8_decode( fileName.c_str() );
+         FILE* file = _wfopen( wFileName, L"r" );
+#else
          FILE* file = fopen( fileName.c_str(), "r" );
-
+#endif
          char* content = NULL;
          int count = 0;
 
index a704c0d6392b7918318eb990468351aa5bfcb6bf..885e73a6c385184ae602d86174658782a17875a6 100644 (file)
@@ -41,6 +41,8 @@
 #include <vtkOpenGL.h>
 #include <vtkObjectFactory.h>
 
+#include <Basics_Utils.hxx>
+
 vtkStandardNewMacro(VTKViewer_OpenGLRenderer);
 
 VTKViewer_OpenGLRenderer::VTKViewer_OpenGLRenderer()
@@ -74,7 +76,13 @@ void VTKViewer_OpenGLRenderer::Clear(void)
   {
     if (this->BackgroundProgram == 0)
     {
-      std::string filePath = std::string( getenv( "GUI_ROOT_DIR") ) + "/share/salome/resources/gui/Background";
+#if defined(WIN32) && defined(UNICODE)
+       std::wstring wFilePath = std::wstring( _wgetenv(L"GUI_ROOT_DIR") ) + L"/share/salome/resources/gui/Background";
+       std::string filePath = Kernel_Utils::utf8_encode_s( wFilePath );
+#else
+       std::string filePath = std::string(getenv("GUI_ROOT_DIR")) + "/share/salome/resources/gui/Background";
+#endif
+      
       if (!this->OpenGLHelper.CreateShaderProgram (filePath,
                                                    this->BackgroundProgram,
                                                    this->BackgroundVertexShader,
index 1e91624cb1971b085e77232e80c9966399fc6f92..959948f68b2cb02374e02515f0ecd26f1c14bd44 100644 (file)
@@ -42,6 +42,8 @@
 #include <vtkCommand.h>
 #include <vtkCellData.h>
 
+#include <Basics_Utils.hxx>
+
 #ifndef WIN32
 # ifndef GLX_GLXEXT_LEGACY
 #  define GLX_GLXEXT_LEGACY
@@ -157,7 +159,12 @@ VTKViewer_PolyDataMapper::~VTKViewer_PolyDataMapper()
 int VTKViewer_PolyDataMapper::InitShader()
 {
 #ifdef VTK_OPENGL2
+#if defined(WIN32) && defined(UNICODE)
+       std::wstring wFilePath = std::wstring(_wgetenv(L"GUI_ROOT_DIR")) + L"/share/salome/resources/gui/Point";
+       std::string filePath = Kernel_Utils::utf8_encode_s(wFilePath.c_str());
+#else
   std::string filePath = std::string( getenv( "GUI_ROOT_DIR") ) + "/share/salome/resources/gui/Point";
+#endif
   if( !this->OpenGLHelper.CreateShaderProgram(filePath, this->PointProgram, this->VertexShader, this->FragmentShader) )
     return false;
 
@@ -174,9 +181,14 @@ int VTKViewer_PolyDataMapper::InitShader()
   this->OpenGLHelper.vglUseProgramObjectARB( current_program );
 
   this->OpenGLHelper.vglGenVertexArraysARB(1, &this->VertexArrayObject);
+#else
+#if defined(WIN32) && defined(UNICODE)
+       std::wstring wFilePath = std::wstring(_wgetenv( L"GUI_ROOT_DIR" ) ) + L"/share/salome/resources/gui/Vertex_Program_ARB.txt";
+       std::string fileName = Kernel_Utils::utf8_encode( wFilePath.c_str() );
 #else
   std::string fileName = std::string( getenv( "GUI_ROOT_DIR") ) +
                          "/share/salome/resources/gui/Vertex_Program_ARB.txt";
+#endif
 
   char* shader = GUI_OPENGL::readFromFile( fileName );