edd82b556567eda529c75a20dd73f9c27b151cbe
braney
  Fri Mar 22 10:48:38 2013 -0700
fix a problem that Hiram found where twoBitIsFile was errAborting if you gave it a directory name which is how netToAxt was calling it.
diff --git src/lib/twoBit.c src/lib/twoBit.c
index ec0ea4a..5cdd0b3 100644
--- src/lib/twoBit.c
+++ src/lib/twoBit.c
@@ -1,27 +1,28 @@
 #include "common.h"
 #include "hash.h"
 #include "dnaseq.h"
 #include "dnautil.h"
 #include "sig.h"
 #include "localmem.h"
 #include "linefile.h"
 #include "obscure.h"
 #include "bPlusTree.h"
 #include "twoBit.h"
 #include "udc.h"
 #include "net.h"
+#include "portable.h"
 #include <limits.h>
 
 /* following are the wrap functions for the UDC and stdio functoins
  * that read twoBit files.   All of these are to get around the C compiler
  * complaining about the automatic cast of a void * to FILE * or 
  * struct udcFile *.
  */
 /* first the UDC wrappers */
 static void udcSeekCurWrap(void *file, bits64 offset)
 {
 udcSeekCur((struct udcFile *)file, offset);
 }
 
 static void udcSeekWrap(void *file, bits64 offset)
 {
@@ -886,30 +887,33 @@
     {
     name = slNameNew(index->name);
     slAddHead(&list, name);
     }
 twoBitClose(&tbf);
 slReverse(&list);
 return list;
 }
 
 boolean twoBitIsFile(char *fileName)
 /* Return TRUE if file is in .2bit format. */
 {
 boolean useUdc = FALSE;
 if (hasProtocol(fileName))
     useUdc = TRUE;
+else if (!isRegularFile(fileName))
+    return FALSE;
+
 struct twoBitFile *tbf = getTbfAndOpen(fileName, useUdc);
 boolean isSwapped;
 boolean isTwoBit = twoBitSigRead(tbf, &isSwapped);
 
 (*tbf->ourClose)(&tbf->f);
 
 return isTwoBit;
 }
 
 boolean twoBitParseRange(char *rangeSpec, char **retFile, 
 	char **retSeq, int *retStart, int *retEnd)
 /* Parse out something in format
  *    file/path/name:seqName:start-end
  * or
  *    file/path/name:seqName