]> git.donarmstrong.com Git - mothur.git/blobdiff - setdircommand.cpp
added multiple processors option for Windows users to align.seqs, dist.seqs, summary...
[mothur.git] / setdircommand.cpp
index 16e93b5e4f5e8feeb864693a3d4a96ac75b9ed61..0b3379cf230967f48e41c234e26c8c98b593c540 100644 (file)
@@ -43,7 +43,7 @@ string SetDirectoryCommand::getHelpString(){
                helpString += "To set the tempdefault to the directory where mothur.exe is located you may enter: tempdefault=default.\n";
                helpString += "The set.dir command should be in the following format: set.dir(output=yourOutputDirectory, input=yourInputDirectory, tempdefault=yourTempDefault).\n";
                helpString += "Example set.outdir(output=/Users/lab/desktop/outputs, input=/Users/lab/desktop/inputs).\n";
-               helpString += "Note: No spaces between parameter labels (i.e. output), '=' and parameters (i.e.yourOutputDirectory).\n\n";
+               helpString += "Note: No spaces between parameter labels (i.e. output), '=' and parameters (i.e.yourOutputDirectory).\n";
                return helpString;
        }
        catch(exception& e) {
@@ -59,11 +59,10 @@ SetDirectoryCommand::SetDirectoryCommand(string option)  {
                
                //allow user to run help
                if(option == "help") { help(); abort = true; calledHelp = true; }
+               else if(option == "citation") { citation(); abort = true; calledHelp = true;}
                
                else {
-                       //valid paramters for this command
-                       string Array[] =  {"output","input","tempdefault","outputdir","inputdir"};
-                       vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+                       vector<string> myArray = setParameters();
                        
                        OptionParser parser(option);
                        map<string, string> parameters = parser.getParameters();
@@ -102,13 +101,15 @@ int SetDirectoryCommand::execute(){
                
                commandFactory = CommandFactory::getInstance();
                
+               m->mothurOut("Mothur's directories:"); m->mothurOutEndLine();
+               
                //redirect output
                if ((output == "clear") || (output == "")) {  output = "";  commandFactory->setOutputDirectory(output);  }
                else if (output == "default") { 
                        string exepath = m->argv;
                        output = exepath.substr(0, (exepath.find_last_of('m')));
                        
-                       m->mothurOut("Changing output directory to " + output); m->mothurOutEndLine();  
+                       m->mothurOut("outputDir=" + output); m->mothurOutEndLine();  
                        commandFactory->setOutputDirectory(output);
                }else {
                        //add / to name if needed
@@ -128,8 +129,8 @@ int SetDirectoryCommand::execute(){
                                m->mothurOut(output + " directory does not exist or is not writable."); m->mothurOutEndLine(); 
                        }else{
                                out.close();
-                               remove(outTemp.c_str());
-                               m->mothurOut("Changing output directory to " + output); m->mothurOutEndLine();  
+                               m->mothurRemove(outTemp);
+                               m->mothurOut("outputDir=" + output); m->mothurOutEndLine();  
                                commandFactory->setOutputDirectory(output);
                        }
                }
@@ -140,7 +141,7 @@ int SetDirectoryCommand::execute(){
                        string exepath = m->argv;
                        input = exepath.substr(0, (exepath.find_last_of('m')));
                        
-                       m->mothurOut("Changing input directory to " + input); m->mothurOutEndLine();  
+                       m->mothurOut("inputDir=" + input); m->mothurOutEndLine();  
                        commandFactory->setInputDirectory(input);
                }else {
                        //add / to name if needed
@@ -160,8 +161,8 @@ int SetDirectoryCommand::execute(){
                                m->mothurOut(input + " directory does not exist or is not writable."); m->mothurOutEndLine(); 
                        }else{
                                in.close();
-                               remove(inTemp.c_str());
-                               m->mothurOut("Changing input directory to " + input); m->mothurOutEndLine();  
+                               m->mothurRemove(inTemp);
+                               m->mothurOut("inputDir=" + input); m->mothurOutEndLine();  
                                commandFactory->setInputDirectory(input); 
                        }
                }
@@ -170,7 +171,7 @@ int SetDirectoryCommand::execute(){
                if (tempdefault == "clear") {  
                        #ifdef MOTHUR_FILES
                                string temp = MOTHUR_FILES; 
-                               m->mothurOut("Resetting default directory to " + temp); m->mothurOutEndLine();  
+                               m->mothurOut("tempDefault=" + temp); m->mothurOutEndLine();  
                                m->setDefaultPath(temp);
                        #else
                                string temp = ""; 
@@ -182,7 +183,7 @@ int SetDirectoryCommand::execute(){
                        string exepath = m->argv;
                        tempdefault = exepath.substr(0, (exepath.find_last_of('m')));
                        
-                       m->mothurOut("Changing default directory to " + tempdefault); m->mothurOutEndLine();  
+                       m->mothurOut("tempDefault=" + tempdefault); m->mothurOutEndLine();  
                        m->setDefaultPath(tempdefault);
                }else {
                        //add / to name if needed
@@ -193,7 +194,7 @@ int SetDirectoryCommand::execute(){
                                if (lastChar != "\\") { tempdefault += "\\"; }  
                        #endif
                        
-                       m->mothurOut("Changing default directory to " + tempdefault); m->mothurOutEndLine();  
+                       m->mothurOut("tempDefault=" + tempdefault); m->mothurOutEndLine();  
                        m->setDefaultPath(tempdefault);
                }