ed552b421c008dad0b93b880923362902bf1e3d1
max
  Wed Apr 2 08:46:02 2014 -0700
Fixing hgVai again for gbib, refs #11957 and refs #12717. One problemwas that show tables cannot fail over. Probably need to libify
one day as a sqlShowTables() function. Another problem are the nib
directories in hg18. Working towards replacing all nib directories with their
twoBit versions via a hg.conf statement.

diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c
index 8028db5..d56e3aa 100644
--- src/hg/lib/hdb.c
+++ src/hg/lib/hdb.c
@@ -2421,34 +2421,43 @@
 return organism;
 }
 
 char *hGenomeOrArchive(char *database)
 /* Return genome name associated from the regular or the archive database. */
 {
 char *genome = hGenome(database);
 if (!genome)
     genome = hArchiveDbDbOptionalField(database, "genome");
 return genome;
 }
 
 char *hDbDbNibPath(char *database)
 /* return nibPath from dbDb for database, has to be freed */
 {
-char *rawNibPath = hDbDbOptionalField(database, "nibPath");
-char *nibPath = hReplaceGbdb(rawNibPath);
-freez(&rawNibPath);
-return nibPath;
+char* seqDir = NULL;
+bool useNib = cfgOptionBooleanDefault("allowNib", TRUE);
+if (useNib)
+    seqDir = hDbDbOptionalField(database, "nibPath");
+else
+    {
+    char buf[4096];
+    safef(buf, sizeof(buf), "/gbdb/%s", database);
+    char *twoBitDir = hReplaceGbdbSeqDir(buf, database);
+    seqDir = twoBitDir;
+    fprintf(stderr, "twoBitDir %s\n", twoBitDir);
+    }
+return seqDir;
 }
 
 char *hGenome(char *database)
 /* Return genome associated with database.
  * use freeMem on this when done. */
 {
 return hDbDbOptionalField(database, "genome");
 }
 
 char *hScientificName(char *database)
 /* Return scientific name for organism represented by this database */
 /* Return NULL if unknown database */
 /* NOTE: must free returned string after use */
 {
 return hDbDbOptionalField(database, "scientificName");