Salome HOME
Fix problem with incorrect application dir path
authorvsr <vsr@opencascade.com>
Tue, 10 Feb 2009 10:02:52 +0000 (10:02 +0000)
committervsr <vsr@opencascade.com>
Tue, 10 Feb 2009 10:02:52 +0000 (10:02 +0000)
bin/SALOME_InstallWizard
src/SALOME_HelpWindow.cxx
src/SALOME_InstallWizard.cxx
src/SALOME_InstallWizard.hxx

index eb818dbba91c69603e3105aec441170267900807..8ae42d9f3bca4d18412aaa72448eb3244e3510d8 100755 (executable)
Binary files a/bin/SALOME_InstallWizard and b/bin/SALOME_InstallWizard differ
index bbaafd1b024fd880cecaa8c46678a4ce0a85fc54..c0f076391acc897d35bfbf3b9e126a34ca77fb33 100644 (file)
@@ -31,7 +31,7 @@
 // ================================================================
 HelpWindow::HelpWindow( SALOME_InstallWizard* wizard ) : QMainWindow( 0, "SalomeProHelpWindow", WDestructiveClose )
 {
-  QString hlpFile = QDir::currentDirPath() + "/doc/readme.html";
+  QString hlpFile = QDir( SALOME_InstallWizard::rootDirPath() ).filePath( "doc/readme.html" );
   QString hlpDir = ".";
   // caption
   setCaption( wizard->getCaption() + " " + wizard->getIWName() + " " + tr( "Help" ) );
@@ -149,7 +149,7 @@ void HelpWindow::keyPressEvent( QKeyEvent* e )
 // ================================================================
 HelpWindow* HelpWindow::openHelp( SALOME_InstallWizard* wizard )
 {
-  if ( QFile::exists( QDir::currentDirPath() + "/doc/readme.html" ) )
+  if ( QFile::exists( QDir( SALOME_InstallWizard::rootDirPath() ).filePath( "doc/readme.html" ) ) )
     return new HelpWindow( wizard );
   else
     return 0;
index 22a0e8c93060bf2ab814fe473dd43dce3a2222f3..1510dc5821d27fd8092072c9b33070a48850686a 100644 (file)
@@ -490,10 +490,9 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
   singleDir    = aSingleDir;
   stateChanged = true;
 
-  QDir appDir( qApp->applicationDirPath() );
-  appDir.cdUp();
-  binPath = appDir.filePath( "Products/BINARIES" );
-  srcPath = appDir.filePath( "Products/SOURCES" );
+  QDir rootDir( rootDirPath() );
+  binPath = rootDir.filePath( "Products/BINARIES" );
+  srcPath = rootDir.filePath( "Products/SOURCES" );
   oneProdDirName = "PRODUCTS";
   
   commonPlatform = "Debian 3.1";
@@ -689,6 +688,24 @@ QStringList SALOME_InstallWizard::currentPlatform()
   if ( !platArch.isEmpty() )    vals.append( platArch ); 
   return vals;
 }
+
+// ================================================================
+/*!
+ *  SALOME_InstallWizard::rootDirPath
+ *  Get application root dir
+ */
+// ================================================================
+QString SALOME_InstallWizard::rootDirPath()
+{
+  static QString rootDir;
+  if ( rootDir.isEmpty() ) {
+    QDir appDir( qApp->applicationDirPath() );
+    appDir.cdUp();
+    rootDir = appDir.absPath();
+  }
+  return rootDir;
+}
+
 // ================================================================
 /*!
  *  SALOME_InstallWizard::getPlatformBinPath
@@ -714,7 +731,7 @@ MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& aXmlFileName )
   if ( !aXmlFileName.isEmpty() )
     xmlList.append( aXmlFileName );
   else {
-    QDir dir( QDir::currentDirPath() );
+    QDir dir( rootDirPath() );
     xmlList = dir.entryList( "*.xml", QDir::Files | QDir::Readable );
   }
   if ( xmlList.remove( "config.xml" ) )
@@ -1335,7 +1352,7 @@ void SALOME_InstallWizard::setupReadmePage()
   pageLayout->addLayout( hLayout );
 
   // loading README file
-  QString readmeFile = QDir::currentDirPath() + "/README";
+  QString readmeFile = QDir( rootDirPath() ).filePath( "README" );
   QString text;
   if ( readFile( readmeFile, text ) )
     readme->setText( text );
@@ -2106,7 +2123,7 @@ void SALOME_InstallWizard::launchScript()
     if ( notInstall.contains( prodProc ) || prodProc == "gcc" ) {
       shellProcess->addArgument( "try_preinstalled" );
       shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() );
-      shellProcess->addArgument( QDir::currentDirPath() + "/Products" );
+      shellProcess->addArgument( QDir( rootDirPath() ).filePath( "Products" ) );
       statusLab->setText( tr( "Collecting environment for '" ) + prodProc + "'..." );
     }
     // ... binaries ?
@@ -2199,7 +2216,7 @@ void SALOME_InstallWizard::launchScript()
       script += item->text(2) + " ";
       script += "pickup_env ";
       script += QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ) + " ";
-      script += QUOTE( QFileInfo( QDir::cleanDirPath( QDir::currentDirPath() + "/Products" ) ).absFilePath() ) + " ";
+      script += QUOTE( QFileInfo( QDir::cleanDirPath( QDir( rootDirPath() ).filePath( "Products" ) ) ).absFilePath() ) + " ";
       script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " ";
       script += depproducts + " ";
       script += item->text(0) + " ";
index 3d18fac874912424587fe1e09d9e27b45fb1b5b8..4a42840ce50208b15cd62d8d7c06db34bbe5c905 100644 (file)
@@ -172,6 +172,8 @@ class SALOME_InstallWizard: public InstallWizard
   QString getBasePlatform();
   // get current platform
   static QStringList currentPlatform();
+  // get application root dir
+  static QString     rootDirPath();
 
   // get binaries path
   QString getBinPath() const { return binPath; }