//**********************************************************************************************************************
vector<string> SetLogFileCommand::setParameters(){
try {
- CommandParameter pappend("append", "Boolean", "", "F", "", "", "",false,false); parameters.push_back(pappend);
- CommandParameter pname("name", "String", "", "", "", "", "",false,true); parameters.push_back(pname);
- CommandParameter pinputdir("inputdir", "String", "", "", "", "", "",false,false); parameters.push_back(pinputdir);
- CommandParameter poutputdir("outputdir", "String", "", "", "", "", "",false,false); parameters.push_back(poutputdir);
+ CommandParameter pappend("append", "Boolean", "", "F", "", "", "","",false,false); parameters.push_back(pappend);
+ CommandParameter pname("name", "String", "", "", "", "", "","",false,true,true); parameters.push_back(pname);
+ CommandParameter pinputdir("inputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(pinputdir);
+ CommandParameter poutputdir("outputdir", "String", "", "", "", "", "","",false,false); parameters.push_back(poutputdir);
vector<string> myArray;
for (int i = 0; i < parameters.size(); i++) { myArray.push_back(parameters[i].name); }
helpString += "The set.logfile command parameters are name and append, name is required. Append is set to false by default.\n";
helpString += "The set.logfile command should be in the following format: set.logfile(name=yourLogFileName, append=T).\n";
helpString += "Example set.logfile(name=/Users/lab/desktop/output.txt, append=T).\n";
- helpString += "Note: No spaces between parameter labels (i.e. name), '=' and parameters (i.e.yourLogFileName).\n\n";
+ helpString += "Note: No spaces between parameter labels (i.e. name), '=' and parameters (i.e.yourLogFileName).\n";
return helpString;
}
catch(exception& e) {
//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[] = {"name","append","outputdir","inputdir"};
- vector<string> myArray (Array, Array+(sizeof(Array)/sizeof(string)));
+ vector<string> myArray = setParameters();
OptionParser parser(option);
map<string, string> parameters = parser.getParameters();
if (abort == true) { if (calledHelp) { return 0; } return 2; }
- commandFactory = CommandFactory::getInstance();
-
- commandFactory->setLogfileName(name, append);
+ commandFactory = CommandFactory::getInstance();
+
+ string directory = m->hasPath(name);
+ if (directory == "") {
+ commandFactory->setLogfileName(name, append);
+ }else if (m->dirCheck(directory)) {
+ commandFactory->setLogfileName(name, append);
+ }
return 0;
}