}
}
/*********************************************************************************************/
+void MothurOut::setOutputDir(string pathname) {
+ try {
+ outputDir = pathname;
+ }
+ catch(exception& e) {
+ errorOut(e, "MothurOut", "setOutputDir");
+ exit(1);
+ }
+}
+/*********************************************************************************************/
void MothurOut::closeLog() {
try {
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
if (path.find("~") != -1) { //go to home directory
- string homeDir = getenv ("HOME");
+ string homeDir;
+
+ char *homepath = NULL;
+ homepath = getenv ("HOME");
+ if ( homepath != NULL) { homeDir = homepath; }
+ else { homeDir = ""; }
+
newFileName = homeDir + fileName.substr(fileName.find("~")+1);
return newFileName;
}else { //find path
if (path.rfind("./") == -1) { return fileName; } //already complete name
else { newFileName = fileName.substr(fileName.rfind("./")+2); } //save the complete part of the name
- char* cwdpath = new char[1024];
+ //char* cwdpath = new char[1024];
+ //size_t size;
+ //cwdpath=getcwd(cwdpath,size);
+ //cwd = cwdpath;
+
+ char *cwdpath = NULL;
+ cwdpath = getcwd(NULL, 0); // or _getcwd
+ if ( cwdpath != NULL) { cwd = cwdpath; }
+ else { cwd = ""; }
- size_t size;
- cwdpath=getcwd(cwdpath,size);
-
- cwd = cwdpath;
//rip off first '/'
string simpleCWD;
//This function parses the estimator options and puts them in a vector
void MothurOut::splitAtChar(string& estim, vector<string>& container, char symbol) {
try {
- string individual;
+ string individual = "";
+ int estimLength = estim.size();
+ for(int i=0;i<estimLength;i++){
+ if(estim[i] == symbol){
+ container.push_back(individual);
+ individual = "";
+ }
+ else{
+ individual += estim[i];
+ }
+ }
+ container.push_back(individual);
+
+ /*
while (estim.find_first_of(symbol) != -1) {
individual = estim.substr(0,estim.find_first_of(symbol));
}
}
//get last one
- container.push_back(estim);
+ container.push_back(estim); */
}
catch(exception& e) {
errorOut(e, "MothurOut", "splitAtChar");