X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mergefilecommand.cpp;h=643cf287bb9aded0847390aeea1091c12e95dd74;hb=a0f1fca79d2ddfa7ad36b4485039c68b5704fe8d;hp=c944e3bc8774aaa9ccffb712cdda823741c7d2e3;hpb=e150b0b0664caec517485ee6d69dcdade6dcae77;p=mothur.git diff --git a/mergefilecommand.cpp b/mergefilecommand.cpp index c944e3b..643cf28 100644 --- a/mergefilecommand.cpp +++ b/mergefilecommand.cpp @@ -12,10 +12,10 @@ //********************************************************************************************************************** vector MergeFileCommand::setParameters(){ try { - CommandParameter pinput("input", "String", "", "", "", "", "",false,true); parameters.push_back(pinput); - CommandParameter poutput("output", "String", "", "", "", "", "",false,true); parameters.push_back(poutput); - CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir); - CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir); + CommandParameter pinput("input", "String", "", "", "", "", "","",false,true,true); parameters.push_back(pinput); + CommandParameter poutput("output", "String", "", "", "", "", "","",false,true,true); parameters.push_back(poutput); + CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir); + CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir); vector myArray; for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); } @@ -41,7 +41,6 @@ string MergeFileCommand::getHelpString(){ exit(1); } } - //********************************************************************************************************************** MergeFileCommand::MergeFileCommand(){ try { @@ -130,32 +129,13 @@ int MergeFileCommand::execute(){ try { if (abort == true) { if (calledHelp) { return 0; } return 2; } - ofstream outputFile; - m->openOutputFile(outputFileName, outputFile); - - char c; - for(int i=0;iopenInputFile(fileNames[i], inputFile); - - while(!inputFile.eof()){ - if (m->control_pressed) { outputTypes.clear(); inputFile.close(); outputFile.close(); remove(outputFileName.c_str()); return 0; } - - c = inputFile.get(); - //-1 is eof char - if (int(c) != -1) { outputFile << c; } - } - - inputFile.close(); - } - - outputFile.close(); + m->mothurRemove(outputFileName); + for(int i=0;iappendFiles(fileNames[i], outputFileName); } - if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); return 0; } + if (m->control_pressed) { m->mothurRemove(outputFileName); return 0; } m->mothurOutEndLine(); - m->mothurOut("Output File Name: "); m->mothurOutEndLine(); + m->mothurOut("Output File Names: "); m->mothurOutEndLine(); m->mothurOut(outputFileName); m->mothurOutEndLine(); outputNames.push_back(outputFileName); outputTypes["merge"].push_back(outputFileName); m->mothurOutEndLine();