if (path == "") { fastaFileNames[i] = inputDir + fastaFileNames[i]; }
}
- int ableToOpen;
ifstream in;
-
- ableToOpen = openInputFile(fastaFileNames[i], in);
+ int ableToOpen = openInputFile(fastaFileNames[i], in, "noerror");
+
+ //if you can't open it, try default location
+ if (ableToOpen == 1) {
+ if (m->getDefaultPath() != "") { //default path is set
+ string tryPath = m->getDefaultPath() + getSimpleName(fastaFileNames[i]);
+ m->mothurOut("Unable to open " + fastaFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine();
+ ableToOpen = openInputFile(tryPath, in, "noerror");
+ fastaFileNames[i] = tryPath;
+ }
+ }
in.close();
-
+
if (ableToOpen == 1) {
+ m->mothurOut("Unable to open " + fastaFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine();
//erase from file list
fastaFileNames.erase(fastaFileNames.begin()+i);
i--;
}else{ filename += getRootName(getSimpleName(fastaFileNames[i])); }
-
}
filename += "groups";
for (int i = 0; i < fastaFileNames.size(); i++) {
+ if (m->control_pressed) { out.close(); remove(filename.c_str()); return 0; }
+
ifstream in;
openInputFile(fastaFileNames[i], in);
while (!in.eof()) {
- Sequence seq(in); gobble(in);
+ Sequence seq(in, "no align"); gobble(in);
+
+ if (m->control_pressed) { in.close(); out.close(); remove(filename.c_str()); return 0; }
if (seq.getName() != "") { out << seq.getName() << '\t' << groupsNames[i] << endl; }
}