X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=setdircommand.cpp;h=238ffa5ff227eb85bae8dff594a7d1f97d357280;hb=4dbf93479b205ec5d72663e5b01611000266bc13;hp=5a2c0022bf68ef4756d71ad6278b171bbce0f602;hpb=f89b6501b7d80e705b6c50ff2c8bdd8bb5d2edf7;p=mothur.git diff --git a/setdircommand.cpp b/setdircommand.cpp index 5a2c002..238ffa5 100644 --- a/setdircommand.cpp +++ b/setdircommand.cpp @@ -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); } } @@ -79,7 +79,6 @@ int SetDirectoryCommand::execute(){ commandFactory = CommandFactory::getInstance(); - //redirect output if ((output == "clear") || (output == "")) { output = ""; commandFactory->setOutputDirectory(output); } else { @@ -97,11 +96,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 +122,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 +134,7 @@ int SetDirectoryCommand::execute(){ return 0; } catch(exception& e) { - errorOut(e, "SetDirectoryCommand", "SetDirectoryCommand"); + m->errorOut(e, "SetDirectoryCommand", "execute"); exit(1); } }