}
else {
//valid paramters for this command
- string Array[] = {"input", "output"};
+ string Array[] = {"input", "output","outputdir","inputdir"};
vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
OptionParser parser(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") { 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){
}
else{
for(int i=0;i<numInputFiles;i++){
+ if (inputDir != "") {
+ string path = hasPath(fileNames[i]);
+ //if the user has not given a path then, add inputdir. else leave path alone.
+ if (path == "") { fileNames[i] = inputDir + fileNames[i]; }
+ }
+
if(openInputFile(fileNames[i], testFile)){ abort = true; }
testFile.close();
}
outputFileName = validParameter.validFile(parameters, "output", false);
if (outputFileName == "not found") { mothurOut("you must enter an output file name"); mothurOutEndLine(); abort=true; }
+ else if (outputDir != "") { outputFileName = outputDir + getSimpleName(outputFileName); }
}
}