X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fmain.cxx;h=1d1b8d67b7cfe97babdd437a525c05b6e6da753c;hb=7f20464cbfdbb123c2880002895cdbb454e63fbf;hp=3e1697f5e74ead131ce98f371adea9cc66d80115;hpb=59fc4fe49b40fc9fd4ea6407dc95ec20371a44b1;p=tools%2Finstall.git diff --git a/src/main.cxx b/src/main.cxx index 3e1697f..1d1b8d6 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -1,9 +1,9 @@ // File : main.cxx // Created : Thu Dec 18 12:01:00 2002 -// Author : Vadim SANDLER +// Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com) // Project : SALOME // Module : Installation Wizard -// Copyright : 2004-2005 CEA +// Copyright : 2002-2007 CEA #include "globals.h" @@ -50,6 +50,11 @@ int main( int argc, char **argv ) qInstallMsgHandler( MessageOutput ); QString xmlFileName; + QString targetDirPath; + QString tmpDirPath; + bool has_xml = false; + bool has_target = false; + bool has_tmp = false; for( int i = 1; i < argc; i++ ) { QString a = QString( argv[i] ); if ( a == "--version" || a == "-v" ) { @@ -63,31 +68,68 @@ int main( int argc, char **argv ) ( QT_VERSION ) & 0xFF ); return 0; } - if ( xmlFileName.isEmpty() ) - xmlFileName = a; + else if ( a == "--target" || a == "-d" ) { + has_target = true; + if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) { + targetDirPath = argv[i+1]; + i++; + } + else { + targetDirPath = QString::null; + } + } + else if ( a == "--tmp" || a == "-t" ) { + has_tmp = true; + if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) { + tmpDirPath = argv[i+1]; + i++; + } + else { + tmpDirPath = QString::null; + } + } + else if ( a == "--file" || a == "-f" ) { + has_xml = true; + if ( i < argc-1 && !QString( argv[i+1] ).startsWith("-") ) { + xmlFileName = argv[i+1]; + i++; + } + else { + xmlFileName = QString::null; + } + } + } + if ( has_xml && xmlFileName.isEmpty() ) { + printf("Please specify the configuration XML file!\n"); + return 1; + } + if ( has_target && targetDirPath.isEmpty() ) { + printf("Please specify the target directory path!\n"); + return 1; + } + if ( has_tmp && tmpDirPath.isEmpty() ) { + printf("Please specify the temprary directory path!\n"); + return 1; } - if ( xmlFileName.isEmpty() ) - xmlFileName = "config.xml"; QApplication a( argc, argv ); a.setFont( QFont( "Sans", 12 ) ); - int result = -1; - QFile xmlfile(xmlFileName); - if ( xmlfile.exists() ) { - SALOME_InstallWizard wizard(xmlFileName); - a.setMainWidget( &wizard ); - wizard.show(); - result = a.exec(); - } - else { - QMessageBox::critical( 0, - QObject::tr( "Error" ), - QObject::tr( "Can't open config file:\n%1\n\nQuitting...").arg( xmlFileName ), - QMessageBox::Ok, - QMessageBox::NoButton, - QMessageBox::NoButton ); + if ( has_xml ) { + QFile xmlfile(xmlFileName); + if ( !xmlfile.exists() ) { + QMessageBox::critical( 0, + QObject::tr( "Error" ), + QObject::tr( "Can't open config file:\n%1\n\nQuitting...").arg( xmlFileName ), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + return -1; + } } - return result; + SALOME_InstallWizard wizard(xmlFileName, targetDirPath, tmpDirPath); + a.setMainWidget( &wizard ); + wizard.show(); + return a.exec(); }