X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=mothurout.cpp;h=de6da8c217a36a17368be48c21a7116d36a43108;hb=6cf9539162b0fb0b5c0b99673e999df3cd717c55;hp=1231700a42e03b3d733e27141762a6c1e5708f00;hpb=8c616f2509abd2fb9485a38607c1b439d243b85c;p=mothur.git diff --git a/mothurout.cpp b/mothurout.cpp index 1231700..de6da8c 100644 --- a/mothurout.cpp +++ b/mothurout.cpp @@ -60,6 +60,16 @@ void MothurOut::setDefaultPath(string pathname) { } } /*********************************************************************************************/ +void MothurOut::setOutputDir(string pathname) { + try { + outputDir = pathname; + } + catch(exception& e) { + errorOut(e, "MothurOut", "setOutputDir"); + exit(1); + } +} +/*********************************************************************************************/ void MothurOut::closeLog() { try { @@ -502,19 +512,29 @@ string MothurOut::getFullPathName(string fileName){ #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; @@ -1182,7 +1202,20 @@ void MothurOut::getNumSeqs(ifstream& file, int& numSeqs){ //This function parses the estimator options and puts them in a vector void MothurOut::splitAtChar(string& estim, vector& container, char symbol) { try { - string individual; + string individual = ""; + int estimLength = estim.size(); + for(int i=0;i& container, char symbo } } //get last one - container.push_back(estim); + container.push_back(estim); */ } catch(exception& e) { errorOut(e, "MothurOut", "splitAtChar"); @@ -1530,6 +1563,7 @@ bool MothurOut::checkReleaseVersion(ifstream& file, string version) { exit(1); } } + /**************************************************************************************************/