archivers/zip.c
changeset 478 d6fa323f448d
parent 470 27119d6e5d40
child 483 d788c84d8694
equal deleted inserted replaced
477:b458b647e98a 478:d6fa323f448d
  1239 
  1239 
  1240 
  1240 
  1241 static int ZIP_exists(DirHandle *h, const char *name)
  1241 static int ZIP_exists(DirHandle *h, const char *name)
  1242 {
  1242 {
  1243     ZIPinfo *info = (ZIPinfo *) h->opaque;
  1243     ZIPinfo *info = (ZIPinfo *) h->opaque;
  1244     int retval = (zip_find_entry(info, name) != NULL);
  1244     int retval = (zip_find_start_of_dir(info, name, 1) != -1);
  1245 /* !!! FIXME: this would be faster the other way, I think: dirs first. */
  1245     if (!retval)  /* not a dir? Look for a regular file entry... */
  1246     if (!retval)  /* might be a directory... */
  1246         retval = (zip_find_entry(info, name) != NULL);
  1247         retval = (zip_find_start_of_dir(info, name, 1) != -1);
       
  1248     return(retval);
  1247     return(retval);
  1249 } /* ZIP_exists */
  1248 } /* ZIP_exists */
  1250 
  1249 
  1251 
  1250 
  1252 static PHYSFS_sint64 ZIP_getLastModTime(DirHandle *h,
  1251 static PHYSFS_sint64 ZIP_getLastModTime(DirHandle *h,
  1253                                         const char *name,
  1252                                         const char *name,
  1254                                         int *fileExists)
  1253                                         int *fileExists)
  1255 {
  1254 {
  1256     ZIPentry *entry = zip_find_entry((ZIPinfo *) h->opaque, name);
  1255     ZIPinfo *info = (ZIPinfo *) h->opaque;
       
  1256     ZIPentry *entry;
       
  1257 
       
  1258     if (zip_find_start_of_dir(info, name, 1) != -1)
       
  1259     {
       
  1260         *fileExists = 1;
       
  1261         return(1);  /* Best I can do for a dir... */
       
  1262     } /* if */
       
  1263 
       
  1264     entry = zip_find_entry(info, name);
  1257     *fileExists = (entry != NULL);
  1265     *fileExists = (entry != NULL);
  1258     /* !!! FIXME: Fails for directories. */
       
  1259     BAIL_IF_MACRO(entry == NULL, NULL, -1);
  1266     BAIL_IF_MACRO(entry == NULL, NULL, -1);
  1260     return(entry->last_mod_time);
  1267     return(entry->last_mod_time);
  1261 } /* ZIP_getLastModTime */
  1268 } /* ZIP_getLastModTime */
  1262 
  1269 
  1263 
  1270