summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Howard2014-05-08 22:27:18 -0400
committerSimon Howard2014-05-08 22:27:18 -0400
commit541267071a118fe5cc702632fdba5817e27b6f76 (patch)
tree0cb6564c06d0d07e8df151f2237612921b1c7668 /src
parente898c2f0dec6ea5c6365fef9d494c7f94240bea5 (diff)
downloadchocolate-doom-541267071a118fe5cc702632fdba5817e27b6f76.tar.gz
chocolate-doom-541267071a118fe5cc702632fdba5817e27b6f76.tar.bz2
chocolate-doom-541267071a118fe5cc702632fdba5817e27b6f76.zip
music: Allow / separators in substitute filenames.
For substitute music files we want to be able to specify relative paths in a platform-independent way using Unix path separators. Replace Unix-style / separators in the path that was read with the path separator for the native system.
Diffstat (limited to 'src')
-rw-r--r--src/i_sdlmusic.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/i_sdlmusic.c b/src/i_sdlmusic.c
index 81b28515..e7f0aacb 100644
--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -485,6 +485,11 @@ static char *GetFullPath(char *base_filename, char *path)
}
#endif
+ // Paths in the substitute filenames can contain Unix-style /
+ // path separators, but we should convert this to the separator
+ // for the native platform.
+ path = M_StringReplace(path, "/", DIR_SEPARATOR_S);
+
// Copy config filename and cut off the filename to just get the
// parent dir.
basedir = strdup(base_filename);
@@ -499,6 +504,7 @@ static char *GetFullPath(char *base_filename, char *path)
result = strdup(path);
}
free(basedir);
+ free(path);
return result;
}