From a918635cbea7531d00e6cb81c1d74770a7276a15 Mon Sep 17 00:00:00 2001 From: vsr Date: Sat, 15 Oct 2011 13:48:57 +0000 Subject: [PATCH] Change way to optain GUI version --- src/ResExporter/ResourceExporter.cxx | 26 ++------------------------ src/Session/SALOME_Session_Server.cxx | 27 ++------------------------- 2 files changed, 4 insertions(+), 49 deletions(-) diff --git a/src/ResExporter/ResourceExporter.cxx b/src/ResExporter/ResourceExporter.cxx index 8f342455b..56854cf34 100644 --- a/src/ResExporter/ResourceExporter.cxx +++ b/src/ResExporter/ResourceExporter.cxx @@ -43,6 +43,7 @@ The number of parameters is limeted only by maximum possible length of the command line. */ +#include "GUI_version.h" #include "SUIT_ResourceMgr.h" #include #include @@ -55,30 +56,7 @@ */ static QString salomeVersion() { - QString path( ::getenv( "GUI_ROOT_DIR" ) ); - if ( !path.isEmpty() ) - path += QDir::separator(); - path += QString( "bin/salome/VERSION" ); - - QFile vf( path ); - if ( !vf.open( QIODevice::ReadOnly ) ) - return QString(); - - QString line( vf.readLine( 1024 ) ); - vf.close(); - - if ( line.isEmpty() ) - return QString(); - - while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) ) - line.remove( line.length() - 1, 1 ); - - QString ver; - int idx = line.lastIndexOf( ":" ); - if ( idx != -1 ) - ver = line.mid( idx + 1 ).trimmed(); - - return ver; + return GUI_VERSION_STR; } /*! diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 1318dc25f..910543904 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -54,6 +54,7 @@ #include +#include "GUI_version.h" #include #include #include @@ -134,31 +135,7 @@ static const char* pixmap_not_found_xpm[] = { QString salomeVersion() { - QString path( ::getenv( "GUI_ROOT_DIR" ) ); - if ( !path.isEmpty() ) - path += QDir::separator(); - path += QString( "bin/salome/VERSION" ); - - QFile vf( path ); - if ( !vf.open( QIODevice::ReadOnly ) ) - return QString(); - - QString line( vf.readLine( 1024 ) ); - - vf.close(); - - if ( line.isEmpty() ) - return QString(); - - while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) ) - line.remove( line.length() - 1, 1 ); - - QString ver; - int idx = line.lastIndexOf( ":" ); - if ( idx != -1 ) - ver = line.mid( idx + 1 ).trimmed(); - - return ver; + return GUI_VERSION_STR; } class SALOME_ResourceMgr : public SUIT_ResourceMgr -- 2.39.2