source: s10k/Vago/xmlprocessor.cpp@ 1092

Last change on this file since 1092 was 1052, checked in by s10k, 8 years ago

Fixes for MacOS and minor bugfix

File size: 1.3 KB
Line 
1#include "xmlprocessor.h"
2
3XmlProcessor::XmlProcessor(QString AppDir, Logger *myLogger, QStringList *commands)
4{
5 this->AppDir=AppDir;
6 this->myLogger=myLogger;
7 this->commands=commands;
8}
9
10void XmlProcessor::run()
11{
12 QProcess myProcess;
13 QString result = QString();
14 QString errorMessage = "";
15 int numErrors=0;
16
17 myProcess.setWorkingDirectory(this->AppDir);
18
19 for(int i=0; i<this->commands->size(); i++){
20
21 myProcess.start(UtilVago::getXmlToolsExecutable() +" "+this->commands->at(i));
22 myProcess.waitForFinished(-1);
23 result=myProcess.readAllStandardError();
24
25 if(!result.isEmpty()){
26 //catch exception
27 myLogger->writeString("Xml Tools Error: \n"+this->commands->at(i)+"\n"+result);
28 errorMessage=result;
29 numErrors++;
30 }
31
32 }
33
34 this->commands->clear(); //clean list
35
36 //let's cut it a bit, complete error is in log file.
37 if(errorMessage.size()>600){
38 //limit it at 400 characters (not counting the warning at the begin)
39 errorMessage.remove(299,errorMessage.size()-600);
40 errorMessage.insert(299,"\n \t ... \n");
41 errorMessage.insert(0,"This error was been shortened. \nSee the complete error at Vago log file.\n\n");
42 }
43
44 emit resultConversion(errorMessage,numErrors);
45}
46
Note: See TracBrowser for help on using the repository browser.