--- a/archivers/zip.c Wed Aug 28 08:27:27 2002 +0000
+++ b/archivers/zip.c Wed Aug 28 08:27:27 2002 +0000
@@ -1241,10 +1241,9 @@
static int ZIP_exists(DirHandle *h, const char *name)
{
ZIPinfo *info = (ZIPinfo *) h->opaque;
- int retval = (zip_find_entry(info, name) != NULL);
-/* !!! FIXME: this would be faster the other way, I think: dirs first. */
- if (!retval) /* might be a directory... */
- retval = (zip_find_start_of_dir(info, name, 1) != -1);
+ int retval = (zip_find_start_of_dir(info, name, 1) != -1);
+ if (!retval) /* not a dir? Look for a regular file entry... */
+ retval = (zip_find_entry(info, name) != NULL);
return(retval);
} /* ZIP_exists */
@@ -1253,9 +1252,17 @@
const char *name,
int *fileExists)
{
- ZIPentry *entry = zip_find_entry((ZIPinfo *) h->opaque, name);
+ ZIPinfo *info = (ZIPinfo *) h->opaque;
+ ZIPentry *entry;
+
+ if (zip_find_start_of_dir(info, name, 1) != -1)
+ {
+ *fileExists = 1;
+ return(1); /* Best I can do for a dir... */
+ } /* if */
+
+ entry = zip_find_entry(info, name);
*fileExists = (entry != NULL);
- /* !!! FIXME: Fails for directories. */
BAIL_IF_MACRO(entry == NULL, NULL, -1);
return(entry->last_mod_time);
} /* ZIP_getLastModTime */