summaryrefslogtreecommitdiff
path: root/src/d_iwad.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/d_iwad.c')
-rw-r--r--src/d_iwad.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/d_iwad.c b/src/d_iwad.c
index f4155349..293553a2 100644
--- a/src/d_iwad.c
+++ b/src/d_iwad.c
@@ -423,7 +423,7 @@ static char *CheckDirectoryHasIWAD(char *dir, char *iwadname)
// As a special case, the "directory" may refer directly to an
// IWAD file if the path comes from DOOMWADDIR or DOOMWADPATH.
-
+
if (DirIsFile(dir, iwadname) && M_FileExists(dir))
{
return strdup(dir);
@@ -432,15 +432,14 @@ static char *CheckDirectoryHasIWAD(char *dir, char *iwadname)
// Construct the full path to the IWAD if it is located in
// this directory, and check if it exists.
- filename = malloc(strlen(dir) + strlen(iwadname) + 3);
-
if (!strcmp(dir, "."))
{
- strcpy(filename, iwadname);
+ filename = strdup(iwadname);
}
else
{
- sprintf(filename, "%s%c%s", dir, DIR_SEPARATOR, iwadname);
+ char sep[] = {DIR_SEPARATOR, '\0'};
+ filename = M_StringJoin(dir, sep, iwadname);
}
if (M_FileExists(filename))