}
}
/*********************************************************************************************/
+void MothurOut::setOutputDir(string pathname) {
+ try {
+ outputDir = pathname;
+ }
+ catch(exception& e) {
+ errorOut(e, "MothurOut", "setOutputDir");
+ exit(1);
+ }
+}
+/*********************************************************************************************/
void MothurOut::closeLog() {
try {
/***********************************************************************/
void MothurOut::gobble(istream& f){
try {
+
char d;
- while(isspace(d=f.get())) {;}
+ while(isspace(d=f.get())) { ;}
f.putback(d);
}
catch(exception& e) {
#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;
//estimate file breaks
unsigned long int chunkSize = 0;
chunkSize = size / proc;
-
+
//file to small to divide by processors
if (chunkSize == 0) { proc = 1; filePos.push_back(size); return filePos; }
char c = in.get();
if (c == '>') { in.putback(c); newSpot = in.tellg(); break; }
}
-
+
//there was not another sequence before the end of the file
unsigned long int sanityPos = in.tellg();
//sanity check filePos
for (int i = 0; i < (filePos.size()-1); i++) {
- if (filePos[(i+1)] <= filePos[i]) { filePos.erase(filePos.begin()+(i+1)); i--; }
+ if (filePos[(i+1)] <= filePos[i]) { cout << "erasing " << (i+1) << endl; filePos.erase(filePos.begin()+(i+1)); i--; }
}
proc = (filePos.size() - 1);
//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");
exit(1);
}
}
+
/**************************************************************************************************/