From 7fc206d6142976bfb70383b79e3febccf056964f Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 23 Dec 2008 11:10:01 +0000 Subject: [PATCH] Fix problems: - wrong binaries and sourcse path - wrong processing of /etc/issue file (ignore empty strings) --- src/SALOME_InstallWizard.cxx | 67 ++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/src/SALOME_InstallWizard.cxx b/src/SALOME_InstallWizard.cxx index 117c253..7008dcf 100644 --- a/src/SALOME_InstallWizard.cxx +++ b/src/SALOME_InstallWizard.cxx @@ -489,8 +489,11 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, forceSrc = aForceSrc; singleDir = aSingleDir; stateChanged = true; - binPath = QDir::currentDirPath() + "/Products/BINARIES"; - srcPath = QDir::currentDirPath() + "/Products/SOURCES"; + + QDir appDir( qApp->applicationDirPath() ); + appDir.cdUp(); + binPath = appDir.filePath( "Products/BINARIES" ); + srcPath = appDir.filePath( "Products/SOURCES" ); oneProdDirName = "PRODUCTS"; commonPlatform = "Debian 3.1"; @@ -500,8 +503,8 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, // // ... get current platform curPlatform = currentPlatform().join(" "); -// cout << "curOS = " << curPlatform << endl; -// curPlatform = ""; + //cout << "curOS = " << curPlatform << endl; + //curPlatform = ""; refPlatform = ""; // ... check XML and platform definition getXmlAndPlatform(); @@ -647,32 +650,36 @@ QStringList SALOME_InstallWizard::currentPlatform() QFile file( osFileName ); if ( file.open( IO_ReadOnly ) ) { QTextStream stream( &file ); - QString str = stream.readLine(); - file.close(); - // parse line - QRegExp regvar = QRegExp( "(.*)\\s+[^\\s]*[R|r]elease[^\\s]*\\s+([\\d.]*)" ); - int pos = regvar.search( str ); - if ( pos == -1 ) { - regvar = QRegExp( "(.*)\\s+[^\\s]*[L|l][I|i][N|n][U|u][X|x][^\\s]*(.*)\\s+([\\d.]*)\\s+" ); - pos = regvar.search( str ); - } - if ( pos >= 0 ) { - QStringList name; - for ( int i = 1; i < regvar.numCaptures(); i++ ) - name.append( regvar.cap( i ) ); - - // retrieve platform name - platName = QStringList::split( " ", name.join( " " ) ).join( " " ); - platName = platName.replace( "Linux", "" ).replace( "linux", "" ).replace( "LINUX", "" ).stripWhiteSpace(); - platName = platName.replace( "Welcome to", "" ).stripWhiteSpace(); - platName = QStringList::split( " ", platName ).join( " " ); - // retrieve platform version number - platVersion = regvar.cap( regvar.numCaptures() ); - // retrieve platform - utsname uname_data; - uname( &uname_data ); - if ( QString( uname_data.machine ) == "x86_64" ) - platArch = "64bit"; + while( !stream.atEnd() ) { + QString str = stream.readLine().stripWhiteSpace(); + if ( str.isEmpty() ) continue; + file.close(); + // parse line + QRegExp regvar = QRegExp( "(.*)\\s+[^\\s]*[R|r]elease[^\\s]*\\s+([\\d.]*)" ); + int pos = regvar.search( str ); + if ( pos == -1 ) { + regvar = QRegExp( "(.*)\\s+[^\\s]*[L|l][I|i][N|n][U|u][X|x][^\\s]*(.*)\\s+([\\d.]*)\\s+" ); + pos = regvar.search( str ); + } + if ( pos >= 0 ) { + QStringList name; + for ( int i = 1; i < regvar.numCaptures(); i++ ) + name.append( regvar.cap( i ) ); + + // retrieve platform name + platName = QStringList::split( " ", name.join( " " ) ).join( " " ); + platName = platName.replace( "Linux", "" ).replace( "linux", "" ).replace( "LINUX", "" ).stripWhiteSpace(); + platName = platName.replace( "Welcome to", "" ).stripWhiteSpace(); + platName = QStringList::split( " ", platName ).join( " " ); + // retrieve platform version number + platVersion = regvar.cap( regvar.numCaptures() ); + // retrieve platform + utsname uname_data; + uname( &uname_data ); + if ( QString( uname_data.machine ) == "x86_64" ) + platArch = "64bit"; + break; + } } } } -- 2.39.2