- QApplication a( argc, argv );
- QString xmlFileName( argc == 2 ? argv[1] : "config.xml" );
-
- int result = -1;
- QFile xmlfile(xmlFileName);
- if ( xmlfile.exists() ) {
- SALOME_InstallWizard wizard(xmlFileName);
- a.setMainWidget( &wizard );
- wizard.show();
- result = a.exec();
+
+ 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" ) {
+ printf("SALOME Installation Wizard version %d.%d.%d ",
+ ( __IW_VERSION__ / 10000 ),
+ ( __IW_VERSION__ / 100 % 100 ),
+ ( __IW_VERSION__ % 100 ) );
+ printf("(Qt version %d.%d.%d)\n",
+ ( QT_VERSION >> 16 ) & 0xFF,
+ ( QT_VERSION >> 8 ) & 0xFF,
+ ( QT_VERSION ) & 0xFF );
+ return 0;
+ }
+ 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;