X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=aligncommand.cpp;h=ee27776c11912bd9fe346f300ffc867f5164223f;hp=8d1b40f37cd7eb9edfc708e3b9e856092de5eb5a;hb=80c3fe03a8fd1635d3ad7918ff00beb973449f50;hpb=dfae916a398508554d35c6b3c8002b69becb53be diff --git a/aligncommand.cpp b/aligncommand.cpp index 8d1b40f..ee27776 100644 --- a/aligncommand.cpp +++ b/aligncommand.cpp @@ -107,9 +107,18 @@ AlignCommand::AlignCommand(string option) { if (pid == 0) { #endif - ableToOpen = openInputFile(candidateFileNames[i], in); - in.close(); - + ableToOpen = openInputFile(candidateFileNames[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(candidateFileNames[i]); + m->mothurOut("Unable to open " + candidateFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine(); + ableToOpen = openInputFile(tryPath, in, "noerror"); + candidateFileNames[i] = tryPath; + } + } + in.close(); #ifdef USE_MPI for (int j = 1; j < processors; j++) { MPI_Send(&ableToOpen, 1, MPI_INT, j, 2001, MPI_COMM_WORLD); @@ -122,7 +131,7 @@ AlignCommand::AlignCommand(string option) { #endif if (ableToOpen == 1) { - m->mothurOut(candidateFileNames[i] + " will be disregarded."); m->mothurOutEndLine(); + m->mothurOut("Unable to open " + candidateFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); //erase from file list candidateFileNames.erase(candidateFileNames.begin()+i); i--;