//**********************************************************************************************************************
-SetDirectoryCommand::SetDirectoryCommand(string option){
+SetDirectoryCommand::SetDirectoryCommand(string option) {
try {
abort = false;
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);
}
}
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);
}
}
commandFactory = CommandFactory::getInstance();
-
//redirect output
if ((output == "clear") || (output == "")) { output = ""; commandFactory->setOutputDirectory(output); }
else {
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);
}
}
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);
}
}
return 0;
}
catch(exception& e) {
- errorOut(e, "SetDirectoryCommand", "SetDirectoryCommand");
+ m->errorOut(e, "SetDirectoryCommand", "execute");
exit(1);
}
}