shithub: choc

Download patch

ref: 541267071a118fe5cc702632fdba5817e27b6f76
parent: e898c2f0dec6ea5c6365fef9d494c7f94240bea5
author: Simon Howard <[email protected]>
date: Thu May 8 18:27:18 EDT 2014

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.

--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -485,6 +485,11 @@
     }
 #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 @@
         result = strdup(path);
     }
     free(basedir);
+    free(path);
 
     return result;
 }