Ignore:
Timestamp:
Feb 5, 2014, 7:31:05 PM (11 years ago)
Author:
s10k
Message:

XmlTools2
Added --aei-patch-files-list for AEI2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XmlTools2/trunk/xmlpatch.cpp

    r923 r926  
    100100            for (pugi::xml_node currNodeToInsert = newNode.first_child(); currNodeToInsert; currNodeToInsert = currNodeToInsert.next_sibling())
    101101            {
    102                nodesToInsertion[j].append_copy(currNodeToInsert); // append the new node
     102                nodesToInsertion[j].append_copy(currNodeToInsert); // append the new node
    103103            }
    104104
     
    188188void XmlPatch::executeCommandOperation(const QString &commandString){
    189189
    190     QProcess newXmlToolsInstance;
    191     QString resultOutput;
    192 
    193190    // Avoid infinite fork loops
    194     if(commandString.contains(" -p ") || commandString.contains(" --patch-files ")){
     191    if(commandString.contains("-p ") || commandString.contains("--patch-files ")){
    195192        UtilXmlTools::displayErrorMessage("@COMMAND","Use of --patch-files option is not allowed inside a patch file");
    196193    }
    197194
    198     newXmlToolsInstance.start(GlobalVars::AppExecutable + " " + commandString);
    199     newXmlToolsInstance.waitForFinished(-1); // wait for new instance to finish
    200 
    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");
    206198    }
    207199
    208200    std::cout << "@COMMAND patch operation output:\n"
    209               << "########################################################################\n"
    210               << resultOutput.toLatin1().constData()
    211               << "########################################################################"
    212               << std::endl;
     201    << "########################################################################"
     202    << std::endl;
     203
     204    OptionsParser myParser(Util::QStringToArgsArray(commandString));
     205    myParser.parse();
     206
     207    std::cout
     208    << "########################################################################"
     209    << std::endl;
    213210
    214211    UtilXmlTools::displaySuccessMessage(1,"@COMMAND");
     
    426423        else if(line.startsWith("@COMMAND")){
    427424
    428             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            }
    429442
    430443            command.replace("'","\""); //replace apostrophe by quotes, to avoid problems
     
    433446
    434447            command.clear();
     448            filesWildcard.clear();
    435449        }
    436450        else if(line.startsWith("@CUSTOM_CODE")){
Note: See TracChangeset for help on using the changeset viewer.