Skip to content

Commit

Permalink
Changes to user dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Oct 9, 2001
1 parent ae14014 commit 934d107
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions platform/win32.c
Expand Up @@ -70,16 +70,9 @@ char **__PHYSFS_platformDetectAvailableCDs(void)
} /* __PHYSFS_detectAvailableCDs */


char *__PHYSFS_platformCalcBaseDir(const char *argv0)
static char *getExePath(void)
{
DWORD buflen = 0;
char *retval = NULL;
char *filepart = NULL;

if (strchr(argv0, '\\') != NULL) /* default behaviour can handle this. */
return(NULL);

retval = (char *) malloc(sizeof (TCHAR) * (MAX_PATH + 1));
char *retval = (char *) malloc(sizeof (TCHAR) * (MAX_PATH + 1));
buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1);
retval[buflen] = '\0'; /* does API always null-terminate the string? */

Expand All @@ -105,6 +98,19 @@ char *__PHYSFS_platformCalcBaseDir(const char *argv0)
SearchPath(NULL, argv0, NULL, buflen, retval, &filepart);

return(retval);
} /* getExePath */


char *__PHYSFS_platformCalcBaseDir(const char *argv0)
{
DWORD buflen = 0;
char *retval = NULL;
char *filepart = NULL;

if (strchr(argv0, '\\') != NULL) /* default behaviour can handle this. */
return(NULL);

return(getExePath());
} /* __PHYSFS_platformCalcBaseDir */


Expand Down Expand Up @@ -169,7 +175,8 @@ char *__PHYSFS_platformGetUserDir(void)
} /* if */
} /* if */

return(NULL); /* fall through to default rules. */
/* screw it; it's the same as the base dir... */
return(getExePath());
} /* __PHYSFS_platformGetUserDir */


Expand Down

0 comments on commit 934d107

Please sign in to comment.