deac2d6a8dfdae141830f4ac0b79d86c48d0f0a0
max
  Wed Mar 12 07:23:25 2014 -0700
Moving code from commit 0fb6cafc5cebeb0f383804ed9df2cd01be10227f into hdbbecause it's also needed by hgPcr. refs #11957. (Should not affect RR, as
hReplaceGbdb will return the same string, so it only adds and then
removes a .2bit filename from the path.)

diff --git src/hg/hgBlat/hgBlat.c src/hg/hgBlat/hgBlat.c
index 5f33bcd..fce3f4c 100644
--- src/hg/hgBlat/hgBlat.c
+++ src/hg/hgBlat/hgBlat.c
@@ -76,42 +76,31 @@
 	       isTrans, db);
 sr = sqlGetResult(conn, query);
 if ((row = sqlNextRow(sr)) == NULL)
     {
     errAbort("Can't find a server for %s database %s.  Click "
 	     "<A HREF=\"/cgi-bin/hgBlat?%s&command=start&db=%s\">here</A> "
 	     "to reset to default database.",
 	     (isTrans ? "translated" : "DNA"), db,
 	     cartSidUrlString(cart), hDefaultDb());
     }
 st.db = cloneString(row[0]);
 st.genome = cloneString(row[1]);
 st.isTrans = atoi(row[2]);
 st.host = cloneString(row[3]);
 st.port = cloneString(row[4]);
-
-// hReplaceGbdb checks only if the dir exists
-// with the way nibDir works, we have to check if the 2bit file exists
-// do the rewriting, then strip off the 2bit filename again
-char buf[4096];
-safef(buf, sizeof(buf), "%s/%s.2bit", row[5], st.db);
-char *newPath = hReplaceGbdb(buf);
-
-char dir[4096];
-splitPath(newPath, dir, NULL, NULL);
-st.nibDir = cloneString(dir);
-freeMem(newPath);
+st.nibDir = hReplaceGbdbSeqDir(row[5], st.db);
 
 sqlFreeResult(&sr);
 hDisconnectCentral(&conn);
 return &st;
 }
 
 void findClosestServer(char **pDb, char **pOrg)
 /* If db doesn't have a blat server, look for the closest db (or org) that has one,
  * as hgPcr does. */
 {
 char *db = *pDb, *org = *pOrg;
 struct sqlConnection *conn = hConnectCentral();
 char query[256];
 sqlSafef(query, sizeof(query), "select db from blatServers where db = '%s'", db);
 if (!sqlExists(conn, query))