X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mergefilecommand.cpp;h=0a8c0d8cda62808664a83f46c44cebb770e14f4a;hb=a218321731df14d231bbc08e79906f757cf1540d;hp=497d535e4810fac221b6ae399d59a7b1ff457d46;hpb=02909d6cae9963ba00dc746969a370fa8ca934fc;p=mothur.git diff --git a/mergefilecommand.cpp b/mergefilecommand.cpp index 497d535..0a8c0d8 100644 --- a/mergefilecommand.cpp +++ b/mergefilecommand.cpp @@ -21,7 +21,7 @@ MergeFileCommand::MergeFileCommand(string option){ } else { //valid paramters for this command - string Array[] = {"input", "output"}; + string Array[] = {"input", "output","outputdir","inputdir"}; vector myArray (Array, Array+(sizeof(Array)/sizeof(string))); OptionParser parser(option); @@ -34,36 +34,47 @@ MergeFileCommand::MergeFileCommand(string option){ if (validParameter.isValidParameter(it->first, myArray, it->second) != true) { abort = true; } } + //if the user changes the input directory command factory will send this info to us in the output parameter + string inputDir = validParameter.validFile(parameters, "inputdir", false); + if (inputDir == "not found"){ inputDir = ""; } + string fileList = validParameter.validFile(parameters, "input", false); - if(fileList == "not found") { cout << "you must enter two or more file names" << endl; abort=true; } + if(fileList == "not found") { mothurOut("you must enter two or more file names"); mothurOutEndLine(); abort=true; } else{ splitAtDash(fileList, fileNames); } + //if the user changes the output directory command factory will send this info to us in the output parameter + string outputDir = validParameter.validFile(parameters, "outputdir", false); if (outputDir == "not found") { outputDir = ""; } + + numInputFiles = fileNames.size(); ifstream testFile; if(numInputFiles == 0){ - cout << "you must enter two or more file names and you entered " << fileNames.size() << " file names" << endl; + mothurOut("you must enter two or more file names and you entered " + toString(fileNames.size()) + " file names"); mothurOutEndLine(); abort=true; } else{ for(int i=0;i