--- a/src/archiver_dir.c Thu Mar 15 00:40:00 2012 -0400
+++ b/src/archiver_dir.c Thu Mar 15 01:54:57 2012 -0400
@@ -14,10 +14,10 @@
static void *DIR_openArchive(PHYSFS_Io *io, const char *name, int forWriting)
{
PHYSFS_Stat statbuf;
- const char *dirsep = PHYSFS_getDirSeparator();
+ const char dirsep = __PHYSFS_platformDirSeparator;
char *retval = NULL;
const size_t namelen = strlen(name);
- const size_t seplen = strlen(dirsep);
+ const size_t seplen = 1;
int exists = 0;
assert(io == NULL); /* shouldn't create an Io for these. */
@@ -28,11 +28,14 @@
retval = allocator.Malloc(namelen + seplen + 1);
BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
+ strcpy(retval, name);
+
/* make sure there's a dir separator at the end of the string */
- /* !!! FIXME: is there really any place where (seplen != 1)? */
- strcpy(retval, name);
- if (strcmp((name + namelen) - seplen, dirsep) != 0)
- strcat(retval, dirsep);
+ if (retval[namelen - 1] != dirsep)
+ {
+ retval[namelen] = dirsep;
+ retval[namelen + 1] = '\0';
+ } /* if */
return retval;
} /* DIR_openArchive */