OS/2: fix up the base/user/pref dir code.
There might be better ways to do this in modern times than shove it all into the base dir, though.
This commit is contained in:
parent
062bdc2c5b
commit
d1e40af4e3
|
@ -145,8 +145,6 @@ static void cvt_path_to_correct_case(char *buf)
|
||||||
} /* cvt_file_to_correct_case */
|
} /* cvt_file_to_correct_case */
|
||||||
|
|
||||||
|
|
||||||
static char *baseDir = NULL;
|
|
||||||
|
|
||||||
int __PHYSFS_platformInit(void)
|
int __PHYSFS_platformInit(void)
|
||||||
{
|
{
|
||||||
return 1; /* it's all good. */
|
return 1; /* it's all good. */
|
||||||
|
@ -155,12 +153,6 @@ int __PHYSFS_platformInit(void)
|
||||||
|
|
||||||
int __PHYSFS_platformDeinit(void)
|
int __PHYSFS_platformDeinit(void)
|
||||||
{
|
{
|
||||||
if (baseDir != NULL)
|
|
||||||
{
|
|
||||||
allocator.Free(baseDir);
|
|
||||||
baseDir = NULL;
|
|
||||||
} /* if */
|
|
||||||
|
|
||||||
return 1; /* success. */
|
return 1; /* success. */
|
||||||
} /* __PHYSFS_platformDeinit */
|
} /* __PHYSFS_platformDeinit */
|
||||||
|
|
||||||
|
@ -233,9 +225,6 @@ void __PHYSFS_platformDetectAvailableCDs(PHYSFS_StringCallback cb, void *data)
|
||||||
char *__PHYSFS_platformCalcBaseDir(const char *argv0)
|
char *__PHYSFS_platformCalcBaseDir(const char *argv0)
|
||||||
{
|
{
|
||||||
char *retval = NULL;
|
char *retval = NULL;
|
||||||
|
|
||||||
if (baseDir == NULL)
|
|
||||||
{
|
|
||||||
char buf[CCHMAXPATH];
|
char buf[CCHMAXPATH];
|
||||||
APIRET rc;
|
APIRET rc;
|
||||||
PTIB ptib;
|
PTIB ptib;
|
||||||
|
@ -262,14 +251,9 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0)
|
||||||
/* The string is capitalized! Figure out the REAL case... */
|
/* The string is capitalized! Figure out the REAL case... */
|
||||||
cvt_path_to_correct_case(buf);
|
cvt_path_to_correct_case(buf);
|
||||||
|
|
||||||
baseDir = (char *) allocator.Malloc(len + 1);
|
retval = (char *) allocator.Malloc(len + 1);
|
||||||
BAIL_IF_MACRO(baseDir == NULL, PHYSFS_ERR_OUT_OF_MEMORY, 0);
|
|
||||||
strcpy(baseDir, buf);
|
|
||||||
} /* if */
|
|
||||||
|
|
||||||
retval = (char *) allocator.Malloc(strlen(baseDir) + 1);
|
|
||||||
BAIL_IF_MACRO(retval == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
|
BAIL_IF_MACRO(retval == NULL, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
|
||||||
strcpy(retval, baseDir);
|
strcpy(retval, buf);
|
||||||
return retval;
|
return retval;
|
||||||
} /* __PHYSFS_platformCalcBaseDir */
|
} /* __PHYSFS_platformCalcBaseDir */
|
||||||
|
|
||||||
|
@ -280,11 +264,15 @@ char *__PHYSFS_platformGetUserName(void)
|
||||||
} /* __PHYSFS_platformGetUserName */
|
} /* __PHYSFS_platformGetUserName */
|
||||||
|
|
||||||
|
|
||||||
char *__PHYSFS_platformGetUserDir(void)
|
char *__PHYSFS_platformCalcUserDir(void)
|
||||||
{
|
{
|
||||||
return __PHYSFS_platformCalcBaseDir(NULL);
|
return __PHYSFS_platformCalcBaseDir(NULL); /* !!! FIXME: ? */
|
||||||
} /* __PHYSFS_platformGetUserDir */
|
} /* __PHYSFS_platformCalcUserDir */
|
||||||
|
|
||||||
|
char *__PHYSFS_platformCalcPrefDir(const char *org, const char *app)
|
||||||
|
{
|
||||||
|
return __PHYSFS_platformCalcBaseDir(NULL); /* !!! FIXME: ? */
|
||||||
|
}
|
||||||
|
|
||||||
/* !!! FIXME: can we lose the malloc here? */
|
/* !!! FIXME: can we lose the malloc here? */
|
||||||
char *__PHYSFS_platformCvtToDependent(const char *prepend,
|
char *__PHYSFS_platformCvtToDependent(const char *prepend,
|
||||||
|
|
Loading…
Reference in New Issue