]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - fs.c
Make fgets always return the null string on error.
[xonotic/darkplaces.git] / fs.c
diff --git a/fs.c b/fs.c
index 8fd5d619958b7f2f15a42cbb1040955e20c6b1c7..8571aed1c7cae7ee291eeff9a23913b6d8609a14 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -1819,6 +1819,19 @@ Open a file. The syntax is the same as fopen
 */
 qfile_t* FS_Open (const char* filepath, const char* mode, qboolean quiet, qboolean nonblocking)
 {
+#ifdef FS_FIX_PATHS
+       char fixedFileName[MAX_QPATH];
+       char *d = fixedFileName;
+       // try to fix common mistakes (\ instead of /)
+       for( ; *filepath ; filepath++, d++ )
+               if( *filepath != '\\' )
+                       *d = *filepath;
+               else
+                       *d = '/';
+       *d = '\0';
+       filepath = fixedFileName;
+#endif
+
        if (FS_CheckNastyPath(filepath, false))
        {
                Con_Printf("FS_Open(\"%s\", \"%s\", %s): nasty filename rejected\n", filepath, mode, quiet ? "true" : "false");