| 7 |
|
this->backupsEnabled=!noBackups; |
| 8 |
|
|
| 9 |
|
if(forceTargetFilesWildcard!=""){ |
| 10 |
< |
std::cout << "User forced patch in the target file(s): " << this->forceTargetFilesWildcard.toLatin1().constData() << std::endl; |
| 10 |
> |
std::cout << "User forced patch in the target file(s): " << forceTargetFilesWildcard.toLatin1().constData() << std::endl; |
| 11 |
|
} |
| 12 |
|
|
| 13 |
< |
if(this->patchFilesToProcess.size()==0){ |
| 13 |
> |
if(this->patchFilesToProcess.isEmpty()){ |
| 14 |
|
UtilXmlTools::displayErrorMessage("Loading patch files","No .patch or .oni-patch files were found for the wildcard: "+patchFilesWildcard); |
| 15 |
|
} |
| 16 |
|
|
| 46 |
|
void XmlPatch::addToOperation(const QString &xmlString, XmlFilter &filters, const QString &filesWildcard){ |
| 47 |
|
|
| 48 |
|
QStringList filesToProcess; |
| 49 |
– |
|
| 50 |
– |
filesToProcess=UtilXmlTools::getAllXmlFilesByWildcard(filesWildcard); |
| 51 |
– |
|
| 49 |
|
pugi::xml_node nodeToInsertion; |
| 50 |
|
pugi::xml_document newNode; |
| 51 |
|
pugi::xml_parse_result result; |
| 52 |
|
|
| 53 |
+ |
filesToProcess=UtilXmlTools::getAllXmlFilesByWildcard(filesWildcard); |
| 54 |
+ |
|
| 55 |
+ |
if(filesToProcess.isEmpty()){ |
| 56 |
+ |
UtilXmlTools::displayErrorMessage("@ADD_INSIDE_NODE","No XML files were found for the wildcard: "+filesWildcard); |
| 57 |
+ |
} |
| 58 |
+ |
|
| 59 |
|
result=newNode.load(xmlString.toLatin1().constData()); // load xml to insert |
| 60 |
|
|
| 61 |
|
if(result.status!=pugi::status_ok){ |
| 97 |
|
|
| 98 |
|
QStringList filesToProcess; |
| 99 |
|
|
| 100 |
+ |
pugi::xml_node nodeToDeletion; |
| 101 |
+ |
|
| 102 |
|
filesToProcess=UtilXmlTools::getAllXmlFilesByWildcard(filesWildcard); |
| 103 |
|
|
| 104 |
< |
pugi::xml_node nodeToDeletion; |
| 105 |
< |
pugi::xml_parse_result result; |
| 104 |
> |
if(filesToProcess.isEmpty()){ |
| 105 |
> |
UtilXmlTools::displayErrorMessage("@REMOVE_NODE","No XML files were found for the wildcard: "+filesWildcard); |
| 106 |
> |
} |
| 107 |
|
|
| 108 |
|
// Process all XmlFiles |
| 109 |
|
for(int i=0; i<filesToProcess.size(); i++){ |
| 189 |
|
|
| 190 |
|
filesToProcess=UtilXmlTools::getAllXmlFilesByWildcard(filesWildcard); |
| 191 |
|
|
| 192 |
+ |
if(filesToProcess.isEmpty()){ |
| 193 |
+ |
UtilXmlTools::displayErrorMessage("@CUSTOM_CODE","No XML files were found for the wildcard: "+filesWildcard); |
| 194 |
+ |
} |
| 195 |
+ |
|
| 196 |
|
rexmlfile.open(QFile::ReadOnly | QFile::Text); |
| 197 |
|
jsxmlfile.open(QFile::ReadOnly | QFile::Text); |
| 198 |
|
|
| 286 |
|
|
| 287 |
|
void XmlPatch::checkAndProcessValidCommands(QTextStream &fileStream){ |
| 288 |
|
|
| 289 |
< |
QString line; |
| 280 |
< |
QString filesWildcard; |
| 289 |
> |
QString line, filesWildcard; |
| 290 |
|
QString xmlToInsert, command, jsCode; |
| 291 |
|
XmlFilter filters; |
| 292 |
|
|
| 302 |
|
filters.setParentElementName(getPatchParameterValue(line,"ParentElementName")); |
| 303 |
|
filters.setAttributeName(getPatchParameterValue(line,"AttributeName")); |
| 304 |
|
filters.setAttributeValue(getPatchParameterValue(line,"AttributeValue")); |
| 305 |
< |
if(this->forceTargetFilesWildcard==""){ |
| 306 |
< |
filesWildcard=getPatchParameterValue(line,"Files"); |
| 305 |
> |
|
| 306 |
> |
if(this->forceTargetFilesWildcard!=""){ |
| 307 |
> |
filesWildcard=this->forceTargetFilesWildcard; |
| 308 |
|
} |
| 309 |
|
else{ |
| 310 |
< |
filesWildcard=this->forceTargetFilesWildcard; |
| 310 |
> |
filesWildcard=getPatchParameterValue(line,"Files"); |
| 311 |
|
} |
| 312 |
|
|
| 313 |
|
// Check attribute filters |
| 336 |
|
filters.setParentElementName(getPatchParameterValue(line,"ParentElementName")); |
| 337 |
|
filters.setAttributeName(getPatchParameterValue(line,"AttributeName")); |
| 338 |
|
filters.setAttributeValue(getPatchParameterValue(line,"AttributeValue")); |
| 339 |
< |
if(this->forceTargetFilesWildcard==""){ |
| 340 |
< |
filesWildcard=getPatchParameterValue(line,"Files"); |
| 339 |
> |
|
| 340 |
> |
if(this->forceTargetFilesWildcard!=""){ |
| 341 |
> |
filesWildcard=this->forceTargetFilesWildcard; |
| 342 |
|
} |
| 343 |
|
else{ |
| 344 |
< |
filesWildcard=this->forceTargetFilesWildcard; |
| 344 |
> |
filesWildcard=getPatchParameterValue(line,"Files"); |
| 345 |
|
} |
| 346 |
|
|
| 347 |
|
// Check attribute filters |
| 364 |
|
} |
| 365 |
|
else if(line.startsWith("@CUSTOM_CODE")){ |
| 366 |
|
|
| 367 |
< |
if(this->forceTargetFilesWildcard==""){ |
| 368 |
< |
filesWildcard=getPatchParameterValue(line,"Files"); |
| 367 |
> |
if(this->forceTargetFilesWildcard!=""){ |
| 368 |
> |
filesWildcard=this->forceTargetFilesWildcard; |
| 369 |
|
} |
| 370 |
|
else{ |
| 371 |
< |
filesWildcard=this->forceTargetFilesWildcard; |
| 371 |
> |
filesWildcard=getPatchParameterValue(line,"Files"); |
| 372 |
|
} |
| 373 |
|
|
| 374 |
|
while ( !fileStream.atEnd() && !line.startsWith("</code>")){ |