]> git.donarmstrong.com Git - mothur.git/blobdiff - sharedcommand.cpp
1.18.0 - fixed make.shared abort issue
[mothur.git] / sharedcommand.cpp
index 179424b3c9f395ce88774b00aa7f367581d8f775..2b4d56ec44591400f977e365f6501e89170c9f02 100644 (file)
@@ -75,9 +75,7 @@ SharedCommand::SharedCommand(string option)  {
                
                else {
                        
-                        //valid paramters for this command
-                        string Array[] =  {"list","label","group","groups","ordergroup","outputdir","inputdir"};
-                        vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+                        vector<string> myArray = setParameters();
                         
                         OptionParser parser(option);
                         map<string, string> parameters = parser.getParameters();
@@ -126,7 +124,7 @@ SharedCommand::SharedCommand(string option)  {
                         
                         //check for required parameters
                         listfile = validParameter.validFile(parameters, "list", true);
-                        if (listfile == "not open") { abort = true; }
+                        if (listfile == "not open") { listfile = ""; abort = true; }
                         else if (listfile == "not found") { 
                                 listfile = m->getListFile(); 
                                 if (listfile != "") { m->mothurOut("Using " + listfile + " as input file for the list parameter."); m->mothurOutEndLine(); }
@@ -178,11 +176,11 @@ SharedCommand::SharedCommand(string option)  {
                        //getting output filename
                        filename = listfile;
                        if (outputDir == "") { outputDir += m->hasPath(filename); }
-                       
+                                       
                        filename = outputDir + m->getRootName(m->getSimpleName(filename));
                        filename = filename + "shared";
                        outputTypes["shared"].push_back(filename);
-                       
+                               
                        m->openOutputFile(filename, out);
                        pickedGroups = false;
                                                
@@ -198,10 +196,10 @@ SharedCommand::SharedCommand(string option)  {
                                temp = new ofstream;
                                filehandles[Groups[i]] = temp;
                        }
-                       
+                               
                        //set fileroot
                        fileroot = outputDir + m->getRootName(m->getSimpleName(listfile));
-                       
+                               
                        //clears file before we start to write to it below
                        for (int i=0; i<Groups.size(); i++) {
                                remove((fileroot + Groups[i] + ".rabund").c_str());
@@ -222,6 +220,8 @@ SharedCommand::SharedCommand(string option)  {
 int SharedCommand::execute(){
        try {
                
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
+               
                //lookup.clear();
                string errorOff = "no error";
                //errorOff = "";