#define max( x, y ) ( x ) > ( y ) ? ( x ) : ( y )
#endif
-#define TEMPDIRNAME ( "/INSTALLWORK" + QString::number( getpid() ) )
+QString tmpDirName() { return QString( "/INSTALLWORK" ) + QString::number( getpid() ); }
+#define TEMPDIRNAME tmpDirName()
// ================================================================
/*!
return false;
}
else {
- tempFolder->setText( "/tmp" );
+ tempDir = "/tmp";
+ tempFolder->setText( tempDir );
}
}
QFileInfo fit( QDir::cleanDirPath( tempDir ) );
// ... temp folder
QString tmpFolder = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
- if( !tempFolder->isEnabled() )
- tmpFolder = "/tmp";
+ //if( !tempFolder->isEnabled() )
+ //tmpFolder = "/tmp";
// ... binaries ?
if ( productsView->isBinaries( item ) ) {
#ifdef DEBUG
cout << "All products have been installed successfully" << endl;
#endif
- // all products installed successfully
- QFileInfo fi_sh ( targetFolder->text() + "/env_products.sh");
- QFileInfo fi_csh( targetFolder->text() + "/env_products.csh");
- QCheckListItem* itemBin = findItem( "KERNEL-Bin" );
- QCheckListItem* itemSrc = findItem( "KERNEL-Src" );
- if ( itemBin /*&& !productsView->isNone( itemBin )*/ ) {
- if ( fi_sh.exists() ) {
- QString script = "cp " + fi_sh.filePath() + " " + targetFolder->text() + "/KERNEL_" + itemBin->text(1) + "/salome.sh";
- if ( system( script.latin1() ) ) {}
- }
- if ( fi_csh.exists() ) {
- QString script = "cp " + fi_csh.filePath() + " " + targetFolder->text() + "/KERNEL_" + itemBin->text(1) + "/salome.csh";
- if ( system( script.latin1() ) ) {}
- }
- }
- if ( itemSrc /*&& !productsView->isNone( itemSrc )*/ ) {
- if ( fi_sh.exists() ) {
- QString script = "cp " + fi_sh.filePath() + " " + targetFolder->text() + "/KERNEL_SRC_" + itemSrc->text(1) + "/salome.sh";
- if ( system( script.latin1() ) ) {}
- }
- if ( fi_csh.exists() ) {
- QString script = "cp " + fi_csh.filePath() + " " + targetFolder->text() + "/KERNEL_SRC_" + itemSrc->text(1) + "/salome.csh";
- if ( system( script.latin1() ) ) {}
+ // all products are installed successfully
+ QString workDir = QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() );
+ MapProducts::Iterator mapIter;
+#ifdef DEBUG
+ cout << "starting pick-up environment" << endl;
+#endif
+ for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
+ QCheckListItem* item = mapIter.key();
+ Dependancies dep = mapIter.data();
+ QString depproducts = QUOTE( DefineDependeces(productsMap) );
+ if ( dep.pickUpEnvironment() ) {
+#ifdef DEBUG
+ cout << "... for " << dep.getName() << endl;
+#endif
+ QString script;
+ script += "cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; ";
+ 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( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " ";
+ script += depproducts + " ";
+ script += item->text(0);
+#ifdef DEBUG
+ cout << "... --> " << script.latin1() << endl;
+#endif
+ if ( system( script.latin1() ) ) {
+#ifdef DEBUG
+ cout << "ERROR" << endl;
+#endif
+ }
}
}
// <Next> button
// ================================================================
void SALOME_InstallWizard::onLaunchSalome()
{
- QCheckListItem* item = 0;
- if ( ( item = findItem( "KERNEL-Bin" ) ) ) {
+ QString msg = tr( "You don't have SALOME binaries installed in the %1 directory!" ).arg( targetFolder->text() );
+
+ QCheckListItem* item = findItem( "KERNEL-Bin" );
+ if ( item ) {
QFileInfo fi( targetFolder->text() + "/KERNEL_" + item->text(1) + "/bin/salome/runSalome" );
- if ( fi.exists() ) {
- QString script;
- script += "cd " + targetFolder->text() + "/KERNEL_" + item->text(1) + "; ";
- script += "source salome.csh; ";
- script += "cd bin/salome; ";
- //script += "cd bin; ";
- //script += "runSalome > /dev/null";
- script += "runSalome > /dev/null";
- script = "(csh -c '" + script + "')";
+ QFileInfo fienv( targetFolder->text() + "/KERNEL_" + item->text(1) + "/salome.csh" );
+ if ( fienv.exists() ) {
+ if ( fi.exists() ) {
+ QString script;
+ script += "cd " + targetFolder->text() + "/KERNEL_" + item->text(1) + "; ";
+ script += "source salome.csh; ";
+ script += "cd bin/salome; ";
+ script += "runSalome > /dev/null";
+ script = "(csh -c '" + script + "')";
#ifdef DEBUG
- cout << script.latin1() << endl;
+ cout << script.latin1() << endl;
#endif
- if ( system( script.latin1() ) ){
- QMessageBox::warning( this,
- tr( "Error" ),
- tr( "Can't launch SALOME" ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
+ if ( !system( script.latin1() ) )
+ return;
+ else
+ msg = tr( "Can't launch SALOME." );
}
- return;
+ else
+ msg = tr( "Can't launch SALOME." ) + "\n" + tr( "runSalome file can not be found." );
}
+ else
+ msg = tr( "Can't launch SALOME." ) + "\n" + tr( "Can't find environment file." );
}
QMessageBox::warning( this,
tr( "Error" ),
- tr( "You don't have SALOME binaries installed in the %1 directory!" ).arg( targetFolder->text() ),
+ msg,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton );
{
// VSR: first remove temporary files
QString script = "cd ./config_files/; remove_tmp.sh '";
- script += tempFolder->text().stripWhiteSpace();
+ script += tempFolder->text().stripWhiteSpace() + TEMPDIRNAME;
script += "' ";
script += QUOTE(DefineDependeces(productsMap));
script += " > /dev/null";
}
}
else if ( aPage == readmePage ) {
- QCheckListItem* item = 0;
- runSalomeBtn->setEnabled( ( item = findItem( "KERNEL-Bin" ) ) &&
- QFileInfo( targetFolder->text() + "/KERNEL_" + item->text(1) + "/bin/salome/runSalome" ).exists() );
+ QCheckListItem* item = findItem( "KERNEL-Bin" );
+ runSalomeBtn->setEnabled( item &&
+ QFileInfo( targetFolder->text() + "/KERNEL_" + item->text(1) + "/bin/salome/runSalome" ).exists() &&
+ QFileInfo( targetFolder->text() + "/KERNEL_" + item->text(1) + "/salome.csh" ).exists() );
finishButton()->setEnabled( true );
}
previousPage = aPage;