]> git.donarmstrong.com Git - mothur.git/blobdiff - setdircommand.cpp
created mothurOut class to handle logfiles
[mothur.git] / setdircommand.cpp
index 5a2c0022bf68ef4756d71ad6278b171bbce0f602..407e57bfcaca82628aa60923e9bcb687a6a25416 100644 (file)
@@ -11,7 +11,7 @@
 
 //**********************************************************************************************************************
 
-SetDirectoryCommand::SetDirectoryCommand(string option){
+SetDirectoryCommand::SetDirectoryCommand(string option)  {
        try {
                abort = false;
                
@@ -39,12 +39,12 @@ SetDirectoryCommand::SetDirectoryCommand(string option){
                        if (input == "not found") {  input = "";  }
                                
                        if ((input == "") && (output == "")) {  
-                               mothurOut("You must provide either an input or output for the set.outdir command."); mothurOutEndLine(); abort = true;
+                               m->mothurOut("You must provide either an input or output for the set.outdir command."); m->mothurOutEndLine(); abort = true;
                        }
                }
        }
        catch(exception& e) {
-               errorOut(e, "SetDirectoryCommand", "SetDirectoryCommand");
+               m->errorOut(e, "SetDirectoryCommand", "SetDirectoryCommand");
                exit(1);
        }
 }
@@ -52,17 +52,17 @@ SetDirectoryCommand::SetDirectoryCommand(string option){
 
 void SetDirectoryCommand::help(){
        try {
-               mothurOut("The set.dir command can be used to direct the output files generated by mothur to a specific place, the directory must exist.\n");
-               mothurOut("The set.dir command can also be used to specify the directory where your input files are located, the directory must exist.\n");
-               mothurOut("The set.dir command parameter is output and is required.\n");
-               mothurOut("To return the output to the same directory as the input files you may enter: output=clear.\n");
-               mothurOut("To return the input to the same directory as the mothur.exe you may enter: input=clear.\n");
-               mothurOut("The set.dir command should be in the following format: set.dir(output=yourOutputDirectory, input=yourInputDirectory).\n");
-               mothurOut("Example set.outdir(output=/Users/lab/desktop/outputs, input=/Users/lab/desktop/inputs).\n");
-               mothurOut("Note: No spaces between parameter labels (i.e. output), '=' and parameters (i.e.yourOutputDirectory).\n\n");
+               m->mothurOut("The set.dir command can be used to direct the output files generated by mothur to a specific place, the directory must exist.\n");
+               m->mothurOut("The set.dir command can also be used to specify the directory where your input files are located, the directory must exist.\n");
+               m->mothurOut("The set.dir command parameter is output and is required.\n");
+               m->mothurOut("To return the output to the same directory as the input files you may enter: output=clear.\n");
+               m->mothurOut("To return the input to the same directory as the mothur.exe you may enter: input=clear.\n");
+               m->mothurOut("The set.dir command should be in the following format: set.dir(output=yourOutputDirectory, input=yourInputDirectory).\n");
+               m->mothurOut("Example set.outdir(output=/Users/lab/desktop/outputs, input=/Users/lab/desktop/inputs).\n");
+               m->mothurOut("Note: No spaces between parameter labels (i.e. output), '=' and parameters (i.e.yourOutputDirectory).\n\n");
        }
        catch(exception& e) {
-               errorOut(e, "SetDirectoryCommand", "help");
+               m->errorOut(e, "SetDirectoryCommand", "help");
                exit(1);
        }
 }
@@ -97,11 +97,11 @@ int SetDirectoryCommand::execute(){
                        ofstream out;
                        out.open(outTemp.c_str(), ios::trunc);
                        if(!out) {
-                               mothurOut(output + " directory does not exist or is not writable."); mothurOutEndLine(); 
+                               m->mothurOut(output + " directory does not exist or is not writable."); m->mothurOutEndLine(); 
                        }else{
                                out.close();
                                remove(outTemp.c_str());
-                               mothurOut("Changing output directory to " + output); mothurOutEndLine();  
+                               m->mothurOut("Changing output directory to " + output); m->mothurOutEndLine();  
                                commandFactory->setOutputDirectory(output);
                        }
                }
@@ -123,11 +123,11 @@ int SetDirectoryCommand::execute(){
                        ofstream in;
                        in.open(inTemp.c_str(), ios::trunc);
                        if(!in) {
-                               mothurOut(input + " directory does not exist or is not writable."); mothurOutEndLine(); 
+                               m->mothurOut(input + " directory does not exist or is not writable."); m->mothurOutEndLine(); 
                        }else{
                                in.close();
                                remove(inTemp.c_str());
-                               mothurOut("Changing input directory to " + input); mothurOutEndLine();  
+                               m->mothurOut("Changing input directory to " + input); m->mothurOutEndLine();  
                                commandFactory->setInputDirectory(input); 
                        }
                }
@@ -135,7 +135,7 @@ int SetDirectoryCommand::execute(){
                return 0;
        }
        catch(exception& e) {
-               errorOut(e, "SetDirectoryCommand", "SetDirectoryCommand");
+               m->errorOut(e, "SetDirectoryCommand", "SetDirectoryCommand");
                exit(1);
        }
 }