X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=chimeracheckcommand.cpp;h=f002a026d55d3787d045477e40c1ba8125ea04f8;hp=098896ef6d0ce514c394d677090ba2e38888de84;hb=80c3fe03a8fd1635d3ad7918ff00beb973449f50;hpb=dfae916a398508554d35c6b3c8002b69becb53be diff --git a/chimeracheckcommand.cpp b/chimeracheckcommand.cpp index 098896e..f002a02 100644 --- a/chimeracheckcommand.cpp +++ b/chimeracheckcommand.cpp @@ -73,7 +73,17 @@ ChimeraCheckCommand::ChimeraCheckCommand(string option) { if (pid == 0) { #endif - ableToOpen = openInputFile(fastaFileNames[i], in); + 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(); #ifdef USE_MPI @@ -88,7 +98,7 @@ ChimeraCheckCommand::ChimeraCheckCommand(string option) { #endif if (ableToOpen == 1) { - m->mothurOut(fastaFileNames[i] + " will be disregarded."); m->mothurOutEndLine(); + m->mothurOut("Unable to open " + fastaFileNames[i] +". It will be disregarded."); m->mothurOutEndLine(); //erase from file list fastaFileNames.erase(fastaFileNames.begin()+i); i--; @@ -130,7 +140,17 @@ ChimeraCheckCommand::ChimeraCheckCommand(string option) { if (pid == 0) { #endif - ableToOpen = openInputFile(nameFileNames[i], in); + ableToOpen = openInputFile(nameFileNames[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(nameFileNames[i]); + m->mothurOut("Unable to open " + nameFileNames[i] + ". Trying default " + tryPath); m->mothurOutEndLine(); + ableToOpen = openInputFile(tryPath, in, "noerror"); + nameFileNames[i] = tryPath; + } + } in.close(); #ifdef USE_MPI @@ -145,7 +165,7 @@ ChimeraCheckCommand::ChimeraCheckCommand(string option) { #endif if (ableToOpen == 1) { - m->mothurOut(nameFileNames[i] + " will be disregarded."); m->mothurOutEndLine(); + m->mothurOut("Unable to open " + nameFileNames[i] + ". It will be disregarded."); m->mothurOutEndLine(); //erase from file list nameFileNames.erase(nameFileNames.begin()+i); i--;