]> git.donarmstrong.com Git - mothur.git/blobdiff - chimerabellerophoncommand.cpp
added compile time default path
[mothur.git] / chimerabellerophoncommand.cpp
index 2a38438fdfb4e71b68ac007dde4221a152acd6cf..fd768a753c1798d7f26012f0c8d3f065db7c6252 100644 (file)
@@ -63,7 +63,17 @@ ChimeraBellerophonCommand::ChimeraBellerophonCommand(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  
@@ -78,7 +88,7 @@ ChimeraBellerophonCommand::ChimeraBellerophonCommand(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--;