Skip to content

Commit

Permalink
Added __PHYSFS_platformInit() and __PHYSFS_platformDeinit().
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Mar 24, 2002
1 parent 83ee49d commit 419d5cd
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -70,6 +70,7 @@
"write" functions to get data from a "const" buffer. Added an
"extras" dir, which currently contains PhysFS->SDL_RWops glue code.
03202002 - Patched platform/win32.c to compile.
03242002 - Added __PHYSFS_platformInit() and __PHYSFS_platformDeinit().

--ryan. (icculus@clutteredmind.org)

Expand Down
2 changes: 2 additions & 0 deletions physfs.c
Expand Up @@ -362,6 +362,7 @@ int PHYSFS_init(const char *argv0)

BAIL_IF_MACRO(initialized, ERR_IS_INITIALIZED, 0);
BAIL_IF_MACRO(argv0 == NULL, ERR_INVALID_ARGUMENT, 0);
BAIL_IF_MACRO(!__PHYSFS_platformInit(), NULL, 0);

baseDir = calculateBaseDir(argv0);
BAIL_IF_MACRO(baseDir == NULL, NULL, 0);
Expand Down Expand Up @@ -438,6 +439,7 @@ static void freeSearchPath(void)
int PHYSFS_deinit(void)
{
BAIL_IF_MACRO(!initialized, ERR_NOT_INITIALIZED, 0);
BAIL_IF_MACRO(!__PHYSFS_platformDeinit(), NULL, 0);

closeFileHandleList(&openWriteList);
BAIL_IF_MACRO(!PHYSFS_setWriteDir(NULL), ERR_FILES_STILL_OPEN, 0);
Expand Down
21 changes: 21 additions & 0 deletions physfs_internal.h
Expand Up @@ -319,6 +319,27 @@ int __PHYSFS_verifySecurity(DirHandle *h, const char *fname);
*/
extern const char *__PHYSFS_platformDirSeparator;


/*
* Initialize the platform. This is called when PHYSFS_init() is called from
* the application. You can use this to (for example) determine what version
* of Windows you're running.
*
* Return zero if there was a catastrophic failure (which prevents you from
* functioning at all), and non-zero otherwise.
*/
int __PHYSFS_platformInit(void);

/*
* Deinitialize the platform. This is called when PHYSFS_deinit() is called
* from the application. You can use this to clean up anything you've
* allocated in your platform driver.
*
* Return zero if there was a catastrophic failure (which prevents you from
* functioning at all), and non-zero otherwise.
*/
int __PHYSFS_platformDeinit(void);

/*
* Platform implementation of PHYSFS_getCdRomDirs()...
* See physfs.h. The retval should be freeable via PHYSFS_freeList().
Expand Down
13 changes: 13 additions & 0 deletions platform/unix.c
Expand Up @@ -59,6 +59,19 @@
const char *__PHYSFS_platformDirSeparator = "/";


int __PHYSFS_platformInit(void)
{
return(1); /* always succeed. */
} /* __PHYSFS_platformInit */


int __PHYSFS_platformDeinit(void)
{
return(1); /* always succeed. */
} /* __PHYSFS_platformDeinit */



#if (defined __DARWIN__)

char **__PHYSFS_platformDetectAvailableCDs(void)
Expand Down

0 comments on commit 419d5cd

Please sign in to comment.