]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
SWP12966 - MutiFile is not saved correctly
authorskt <skt@opencascade.com>
Fri, 18 Aug 2006 08:42:11 +0000 (08:42 +0000)
committerskt <skt@opencascade.com>
Fri, 18 Aug 2006 08:42:11 +0000 (08:42 +0000)
Fix in SaveAs() and SaveASCII() - QProcess class usage instead of system() call for system command execution.

src/VISU_I/VISU_Gen_i.cc

index 17a56cc214d4db62ce091595f28232ff922cc2d1..6c890eabef1e13b8693aa01954d9d5766a4e419c 100644 (file)
@@ -72,6 +72,7 @@
 // QT Includes
 #include <qstring.h>
 #include <qfileinfo.h>
+#include <qprocess.h>
 
 // VTK Includes
 #include <vtkRenderer.h>
@@ -333,12 +334,25 @@ namespace VISU
            aFileName = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()) + aFileName;
 
            std::ostringstream aStream;
-           aStream<<"cp "<<aFile<<" "<<aTmpDir<<aFileName;
+                       aStream<<"cp "<<aFile<<" "<<aTmpDir<<aFileName;
            std::string aCommand = aStream.str();
-           if(system(aCommand.c_str()) != 0){
-             INFOS("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
+
+                       QString comm = QDir::convertSeparators( QString(aCommand.c_str()) ); 
+                       const char* cp = comm.latin1();
+
+                       
+                       QProcess* proc = new QProcess();
+                       proc->addArgument( comm );
+                       if(!proc->start())
+                       {
+                               INFOS("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
              continue;
-           }
+                       }
+                       
+                       //if(system(aCommand.c_str()) != 0){
+           //  INFOS("VISU_Gen_i::Save - Cann't execute the command :"<<aCommand);
+           //  continue;
+           //}
          }
          aFileNames.push_back(aFileName);
          aFiles.push_back(aFile);
@@ -398,12 +412,23 @@ namespace VISU
          static QString aCommand;
          aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1());
 
-         int aRes = system(aCommand);
-         if(aRes){
-           if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Can't execute the command :"<<aCommand);
+               QString comm = QDir::convertSeparators( aCommand ); 
+
+               QProcess* proc = new QProcess();
+               proc->addArgument( comm );
+               if(!proc->start())
+               {
+                       if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Can't execute the command :"<<aCommand);
            continue;
-         }else
+               }
+               else
            if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
+         //int aRes = system(aCommand);
+         //if(aRes){
+         //  if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Can't execute the command :"<<aCommand);
+         //  continue;
+         //}else
+         //  if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<<aCommand);
 
          TCollection_AsciiString aString((char *)(aFileName.latin1()));