+ openedBatch = mout->openInputFile(batchFileName, inputBatchFile);
+
+ string temppath = path.substr(0, (path.find_last_of('m')));
+
+ //this will happen if you set the path variable to contain mothur's exe location
+ if (temppath == "") {
+
+ 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;
+ mout->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;
+ }
+