- string envPath = getenv("PATH");
-
- //delimiting path char
- char delim;
- #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
- delim = ':';
- #else
- delim = ';';
- #endif
-
- //break apart path variable by ':'
- vector<string> dirs;
- splitAtChar(envPath, dirs, delim);
-
- //get path related to mothur
- string mothurPath = "";
- for (int i = 0; i < dirs.size(); i++) {
- //to lower so we can find it
- string tempLower = "";
- for (int j = 0; j < dirs[i].length(); j++) { tempLower += tolower(dirs[i][j]); }
-
- //is this mothurs path?
- if (tempLower.find("mothur") != -1) { mothurPath = dirs[i]; break; }
- }
-
- //add mothur so it looks like what argv would look like
- #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
- mothurPath += "/mothur";
- #else
- mothurPath += "\\mothur";
- #endif
-
- path = mothurPath;
- }
-
- globaldata->argv = path;