- if (temp == "not found") {
- lookupFileName = "LookUp_Titanium.pat";
-
- int ableToOpen;
- ifstream in;
- ableToOpen = m->openInputFile(lookupFileName, in, "noerror");
- in.close();
-
- //if you can't open it, try input location
- if (ableToOpen == 1) {
- if (inputDir != "") { //default path is set
- string tryPath = inputDir + lookupFileName;
- m->mothurOut("Unable to open " + lookupFileName + ". Trying input directory " + tryPath); m->mothurOutEndLine();
- ifstream in2;
- ableToOpen = m->openInputFile(tryPath, in2, "noerror");
- in2.close();
- lookupFileName = tryPath;
- }
- }
-
- //if you can't open it, try default location
- if (ableToOpen == 1) {
- if (m->getDefaultPath() != "") { //default path is set
- string tryPath = m->getDefaultPath() + m->getSimpleName(lookupFileName);
- m->mothurOut("Unable to open " + lookupFileName + ". Trying default " + tryPath); m->mothurOutEndLine();
- ifstream in2;
- ableToOpen = m->openInputFile(tryPath, in2, "noerror");
- in2.close();
- lookupFileName = tryPath;
- }
- }
-
- //if you can't open it its not in current working directory or inputDir, try mothur excutable location
- if (ableToOpen == 1) {
- string exepath = m->argv;
- string tempPath = exepath;
- for (int i = 0; i < exepath.length(); i++) { tempPath[i] = tolower(exepath[i]); }
- exepath = exepath.substr(0, (tempPath.find_last_of('m')));
-
- string tryPath = m->getFullPathName(exepath) + m->getSimpleName(lookupFileName);
- m->mothurOut("Unable to open " + lookupFileName + ". Trying mothur's executable location " + tryPath); m->mothurOutEndLine();
- ifstream in2;
- ableToOpen = m->openInputFile(tryPath, in2, "noerror");
- in2.close();
- lookupFileName = tryPath;
- }
-
- if (ableToOpen == 1) { m->mothurOut("Unable to open " + lookupFileName + "."); m->mothurOutEndLine(); abort=true; }
- }
- else if(temp == "not open") {
+ if (temp == "not found") {
+ string path = m->argv;
+ string tempPath = path;
+ for (int i = 0; i < path.length(); i++) { tempPath[i] = tolower(path[i]); }
+ path = path.substr(0, (tempPath.find_last_of('m')));
+
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix)
+ path += "lookupFiles/";
+#else
+ path += "lookupFiles\\";
+#endif
+ lookupFileName = m->getFullPathName(path) + "LookUp_Titanium.pat";
+ bool ableToOpen = m->checkLocations(lookupFileName, inputDir);
+ if (!ableToOpen) { abort=true; }
+ }else if(temp == "not open") {