This commit is contained in:
Ryan C. Gordon 2002-08-28 08:27:27 +00:00
parent fd9dc62fd1
commit 680de768b7
1 changed files with 13 additions and 6 deletions

View File

@ -1241,10 +1241,9 @@ static LinkedStringList *ZIP_enumerateFiles(DirHandle *h,
static int ZIP_exists(DirHandle *h, const char *name) static int ZIP_exists(DirHandle *h, const char *name)
{ {
ZIPinfo *info = (ZIPinfo *) h->opaque; ZIPinfo *info = (ZIPinfo *) h->opaque;
int retval = (zip_find_entry(info, name) != NULL); int retval = (zip_find_start_of_dir(info, name, 1) != -1);
/* !!! FIXME: this would be faster the other way, I think: dirs first. */ if (!retval) /* not a dir? Look for a regular file entry... */
if (!retval) /* might be a directory... */ retval = (zip_find_entry(info, name) != NULL);
retval = (zip_find_start_of_dir(info, name, 1) != -1);
return(retval); return(retval);
} /* ZIP_exists */ } /* ZIP_exists */
@ -1253,9 +1252,17 @@ static PHYSFS_sint64 ZIP_getLastModTime(DirHandle *h,
const char *name, const char *name,
int *fileExists) 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); *fileExists = (entry != NULL);
/* !!! FIXME: Fails for directories. */
BAIL_IF_MACRO(entry == NULL, NULL, -1); BAIL_IF_MACRO(entry == NULL, NULL, -1);
return(entry->last_mod_time); return(entry->last_mod_time);
} /* ZIP_getLastModTime */ } /* ZIP_getLastModTime */