Archive implementation (Build Groupfiles), other tweaks.

This commit is contained in:
Ryan C. Gordon 2001-07-08 05:27:05 +00:00
parent 2622be385d
commit ee508bb2e0
5 changed files with 24 additions and 15 deletions

View File

@ -38,6 +38,7 @@ debugging := true
# Note that various archives may need external libraries.
#-----------------------------------------------------------------------------#
use_archive_zip := false
use_archive_grp := true
#-----------------------------------------------------------------------------#
# Set to "true" if you'd like to build a DLL. Set to "false" otherwise.
@ -45,7 +46,6 @@ use_archive_zip := false
#build_dll := false
build_dll := true
#-----------------------------------------------------------------------------#
# Set one of the below. Currently, none of these are used.
#-----------------------------------------------------------------------------#

View File

@ -19,8 +19,8 @@
#include "physfs_internal.h"
extern const DirFunctions __PHYSFS_DirFunctions_DIR;
static const FileFunctions __PHYSFS_FileHandle_DIR;
static const FileFunctions __PHYSFS_FileHandle_DIRW;
static const FileFunctions __PHYSFS_FileFunctions_DIR;
static const FileFunctions __PHYSFS_FileFunctions_DIRW;
static int DIR_read(FileHandle *handle, void *buffer,
unsigned int objSize, unsigned int objCount)
@ -112,7 +112,8 @@ static DirHandle *DIR_openArchive(const char *name, int forWriting)
int namelen = strlen(name);
int seplen = strlen(dirsep);
BAIL_IF_MACRO(!DIR_isArchive(name, 0), ERR_UNSUPPORTED_ARCHIVE, NULL);
BAIL_IF_MACRO(!DIR_isArchive(name, forWriting),
ERR_UNSUPPORTED_ARCHIVE, NULL);
retval = malloc(sizeof (DirHandle));
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
@ -210,7 +211,7 @@ static FileHandle *doOpen(DirHandle *h, const char *name, const char *mode)
retval->opaque = (void *) rc;
retval->dirHandle = h;
retval->funcs = &__PHYSFS_FileHandle_DIR;
retval->funcs = &__PHYSFS_FileFunctions_DIR;
return(retval);
} /* doOpen */
@ -275,7 +276,7 @@ static void DIR_dirClose(DirHandle *h)
static const FileFunctions __PHYSFS_FileHandle_DIR =
static const FileFunctions __PHYSFS_FileFunctions_DIR =
{
DIR_read, /* read() method */
NULL, /* write() method */
@ -286,7 +287,7 @@ static const FileFunctions __PHYSFS_FileHandle_DIR =
};
static const FileFunctions __PHYSFS_FileHandle_DIRW =
static const FileFunctions __PHYSFS_FileFunctions_DIRW =
{
NULL, /* read() method */
DIR_write, /* write() method */

View File

@ -56,37 +56,37 @@ static DirHandle *ZIP_openArchive(const char *name, int forWriting)
} /* ZIP_openArchive */
static LinkedStringList *ZIP_enumerateFiles(DirHandle *r, const char *dirname)
static LinkedStringList *ZIP_enumerateFiles(DirHandle *h, const char *dirname)
{
} /* ZIP_enumerateFiles */
static int ZIP_exists(DirHandle *r, const char *name)
static int ZIP_exists(DirHandle *h, const char *name)
{
} /* ZIP_exists */
static int ZIP_isDirectory(DirHandle *r, const char *name)
static int ZIP_isDirectory(DirHandle *h, const char *name)
{
} /* ZIP_isDirectory */
static int ZIP_isSymLink(DirHandle *r, const char *name)
static int ZIP_isSymLink(DirHandle *h, const char *name)
{
} /* ZIP_isSymLink */
static FileHandle *ZIP_openRead(DirHandle *r, const char *filename)
static FileHandle *ZIP_openRead(DirHandle *h, const char *filename)
{
} /* ZIP_openRead */
static void ZIP_dirClose(DirHandle *r)
static void ZIP_dirClose(DirHandle *h)
{
} /* ZIP_dirClose */
static const FileFunctions __PHYSFS_FileHandle_ZIP =
static const FileFunctions __PHYSFS_FileFunctions_ZIP =
{
ZIP_read, /* read() method */
NULL, /* write() method */

View File

@ -54,6 +54,10 @@ static const PHYSFS_ArchiveInfo *supported_types[] =
&__PHYSFS_ArchiveInfo_ZIP,
#endif
#if (defined PHYSFS_SUPPORTS_GRP)
&__PHYSFS_ArchiveInfo_GRP,
#endif
NULL
};
@ -63,6 +67,10 @@ static const DirFunctions *dirFunctions[] =
&__PHYSFS_DirFunctions_ZIP,
#endif
#if (defined PHYSFS_SUPPORTS_GRP)
&__PHYSFS_DirFunctions_GRP,
#endif
&__PHYSFS_DirFunctions_DIR,
NULL
};

View File

@ -239,7 +239,7 @@ typedef struct __PHYSFS_DIRFUNCTIONS__
#define ERR_SYMLINK_DISALLOWED "Symbolic links are disabled"
#define ERR_NO_WRITE_DIR "Write directory is not set"
#define ERR_NO_SUCH_FILE "No such file"
#define ERR_PAST_EOF "Past end of file"
/*
* Call this to set the message returned by PHYSFS_getLastError().