platform/win32.c
changeset 127 0d54a1a087d2
parent 119 3ba614e99e70
child 131 69b093825303
--- a/platform/win32.c	Sat Mar 16 03:53:46 2002 +0000
+++ b/platform/win32.c	Thu Mar 21 03:22:04 2002 +0000
@@ -70,10 +70,11 @@
 } /* __PHYSFS_detectAvailableCDs */
 
 
-static char *getExePath(void)
+static char *getExePath(const char *argv0)
 {
+    char *filepart = NULL;
     char *retval = (char *) malloc(sizeof (TCHAR) * (MAX_PATH + 1));
-    buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1);
+    DWORD buflen = GetModuleFileName(NULL, retval, MAX_PATH + 1);
     retval[buflen] = '\0';  /* does API always null-terminate the string? */
 
         /* make sure the string was not truncated. */
@@ -103,14 +104,10 @@
 
 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());
+    return(getExePath(argv0));
 } /* __PHYSFS_platformCalcBaseDir */
 
 
@@ -175,8 +172,7 @@
         } /* if */
     } /* if */
 
-    /* screw it; it's the same as the base dir... */
-    return(getExePath());
+    return(NULL);
 } /* __PHYSFS_platformGetUserDir */