X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothur.cpp;h=bd7ab728c76d311ffe0dc7dcc052a026cfa6e741;hb=c3f0a9c8f932b923f3a6fbbf143e8f4b85fd6f5f;hp=ab4fea0e09482b3c8c988ade3e244fa4c8504750;hpb=c99f3846e7a7b6f06ab46508baa5409204ad6290;p=mothur.git diff --git a/mothur.cpp b/mothur.cpp index ab4fea0..bd7ab72 100644 --- a/mothur.cpp +++ b/mothur.cpp @@ -19,9 +19,8 @@ CommandFactory* CommandFactory::_uniqueInstance = 0; int main(int argc, char *argv[]){ try { - //remove old logfile -// string log = "mothur.logFile"; -// remove(log.c_str()); + string log = "mothur.logFile"; + remove(log.c_str()); time_t ltime = time(NULL); /* calendar time */ string logFileName = "mothur." + toString(ltime) + ".logfile"; @@ -99,19 +98,16 @@ int main(int argc, char *argv[]){ mothur = new InteractEngine(argv[0]); } - //used to intercept the terminate signal, so instead of terminating mothur it will end a command - //void (*prev_fn)(int); - //prev_fn = signal(SIGTERM, mothur->terminateCommand(0)); - - //if (prev_fn==SIG_IGN) signal (SIGTERM,SIG_IGN); - - while(bail == 0) { bail = mothur->getInput(); } - - delete mothur; -// rename(log.c_str(), logFileName.c_str()); //logfile with timestamp + string outputDir = mothur->getOutputDir(); + logFileName = outputDir + logFileName; + + //need this because mothur.h makes the logfile, but doesn't know where to put it + rename(log.c_str(), logFileName.c_str()); //logfile with timestamp + delete mothur; + return 0; } catch(exception& e) {