| 99 |
|
for(int j=0; j<nodesToInsertion.size(); j++){ |
| 100 |
|
for (pugi::xml_node currNodeToInsert = newNode.first_child(); currNodeToInsert; currNodeToInsert = currNodeToInsert.next_sibling()) |
| 101 |
|
{ |
| 102 |
< |
nodesToInsertion[j].append_copy(currNodeToInsert); // append the new node |
| 102 |
> |
nodesToInsertion[j].append_copy(currNodeToInsert); // append the new node |
| 103 |
|
} |
| 104 |
|
|
| 105 |
|
} |
| 187 |
|
|
| 188 |
|
void XmlPatch::executeCommandOperation(const QString &commandString){ |
| 189 |
|
|
| 190 |
– |
QProcess newXmlToolsInstance; |
| 191 |
– |
QString resultOutput; |
| 192 |
– |
|
| 190 |
|
// Avoid infinite fork loops |
| 191 |
< |
if(commandString.contains(" -p ") || commandString.contains(" --patch-files ")){ |
| 191 |
> |
if(commandString.contains("-p ") || commandString.contains("--patch-files ")){ |
| 192 |
|
UtilXmlTools::displayErrorMessage("@COMMAND","Use of --patch-files option is not allowed inside a patch file"); |
| 193 |
|
} |
| 194 |
|
|
| 195 |
< |
newXmlToolsInstance.start(GlobalVars::AppExecutable + " " + commandString); |
| 196 |
< |
newXmlToolsInstance.waitForFinished(-1); // wait for new instance to finish |
| 197 |
< |
|
| 201 |
< |
resultOutput=newXmlToolsInstance.readAll(); |
| 202 |
< |
|
| 203 |
< |
if(newXmlToolsInstance.exitCode()!=0){ |
| 204 |
< |
UtilXmlTools::displayErrorMessage("@COMMAND", "An error ocurred:\n" + resultOutput); |
| 205 |
< |
exit(1); |
| 195 |
> |
// Reserved to AEI |
| 196 |
> |
if(commandString.contains("--aei-patch-files-list ")){ |
| 197 |
> |
UtilXmlTools::displayErrorMessage("@COMMAND","Use of --aei-patch-files-list option is not allowed inside a patch file"); |
| 198 |
|
} |
| 199 |
|
|
| 200 |
|
std::cout << "@COMMAND patch operation output:\n" |
| 201 |
< |
<< "########################################################################\n" |
| 202 |
< |
<< resultOutput.toLatin1().constData() |
| 203 |
< |
<< "########################################################################" |
| 204 |
< |
<< std::endl; |
| 201 |
> |
<< "########################################################################" |
| 202 |
> |
<< std::endl; |
| 203 |
> |
|
| 204 |
> |
OptionsParser myParser(Util::QStringToArgsArray(commandString)); |
| 205 |
> |
myParser.parse(); |
| 206 |
> |
|
| 207 |
> |
std::cout |
| 208 |
> |
<< "########################################################################" |
| 209 |
> |
<< std::endl; |
| 210 |
|
|
| 211 |
|
UtilXmlTools::displaySuccessMessage(1,"@COMMAND"); |
| 212 |
|
} |
| 422 |
|
} |
| 423 |
|
else if(line.startsWith("@COMMAND")){ |
| 424 |
|
|
| 425 |
< |
command=getPatchParameterValue(line,"Arguments"); |
| 425 |
> |
command=GlobalVars::AppExecutable; |
| 426 |
> |
|
| 427 |
> |
// Append files if forced to |
| 428 |
> |
if(!this->forceTargetFilesWildcard.isEmpty()){ |
| 429 |
> |
command+=" --files '"+this->forceTargetFilesWildcard+"' "; |
| 430 |
> |
} |
| 431 |
> |
|
| 432 |
> |
command+=" "+getPatchParameterValue(line,"Options"); |
| 433 |
> |
|
| 434 |
> |
// Add --no-backups and --no-verbose if patch was called with that arguments |
| 435 |
> |
if(!this->backupsEnabled){ |
| 436 |
> |
command.append(" --no-backups"); |
| 437 |
> |
} |
| 438 |
> |
|
| 439 |
> |
if(!this->verboseEnabled){ |
| 440 |
> |
command.append(" --no-verbose"); |
| 441 |
> |
} |
| 442 |
|
|
| 443 |
|
command.replace("'","\""); //replace apostrophe by quotes, to avoid problems |
| 444 |
|
|
| 445 |
|
executeCommandOperation(command); |
| 446 |
|
|
| 447 |
|
command.clear(); |
| 448 |
+ |
filesWildcard.clear(); |
| 449 |
|
} |
| 450 |
|
else if(line.startsWith("@CUSTOM_CODE")){ |
| 451 |
|
|