Salome HOME
Update of products
[tools/install.git] / src / main.cxx
index 15ae14ffcab666c2477d568d915912ac831eb02f..1d1b8d67b7cfe97babdd437a525c05b6e6da753c 100644 (file)
@@ -55,7 +55,6 @@ int main( int argc, char **argv )
   bool has_xml    = false;
   bool has_target = false;
   bool has_tmp    = false;
-  bool force_src  = false;
   for( int i = 1; i < argc; i++ ) {
     QString a = QString( argv[i] );
     if ( a == "--version" || a == "-v" ) {
@@ -76,7 +75,7 @@ int main( int argc, char **argv )
        i++;
       }
       else {
-       tmpDirPath = QString::null;
+       targetDirPath = QString::null;
       }
     }
     else if ( a == "--tmp" || a == "-t" ) {
@@ -99,9 +98,6 @@ int main( int argc, char **argv )
        xmlFileName = QString::null;
       }
     }
-    else if ( a == "--all-from-sources" || a == "-a" ) {
-      force_src = true;
-    }
   }
   if ( has_xml && xmlFileName.isEmpty() ) {
     printf("Please specify the configuration XML file!\n");
@@ -116,28 +112,24 @@ int main( int argc, char **argv )
     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, targetDirPath, tmpDirPath, force_src);
-    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();
 }