]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - fs.c
com_list: Actually initialize a list to point to itself...
[xonotic/darkplaces.git] / fs.c
diff --git a/fs.c b/fs.c
index 87c5df4accacaa479f96ab0e2ebf5e4ca565fa84..f5e67b36519bb7d39cfcc472a2a681162ef166e9 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -1329,6 +1329,10 @@ const char *FS_FileExtension (const char *in)
 {
        const char *separator, *backslash, *colon, *dot;
 
+       dot = strrchr(in, '.');
+       if (dot == NULL)
+               return "";
+
        separator = strrchr(in, '/');
        backslash = strrchr(in, '\\');
        if (!separator || separator < backslash)
@@ -1337,8 +1341,7 @@ const char *FS_FileExtension (const char *in)
        if (!separator || separator < colon)
                separator = colon;
 
-       dot = strrchr(in, '.');
-       if (dot == NULL || (separator && (dot < separator)))
+       if (separator && (dot < separator))
                return "";
 
        return dot + 1;
@@ -1563,7 +1566,7 @@ qbool FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qbool compl
                }
        }
 
-       Host_SaveConfig();
+       Host_SaveConfig(CONFIGFILENAME);
 
        fs_numgamedirs = numgamedirs;
        for (i = 0;i < fs_numgamedirs;i++)
@@ -1574,15 +1577,15 @@ qbool FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qbool compl
 
        if (cls.demoplayback)
        {
-               CL_Disconnect_f(cmd_client);
+               CL_Disconnect();
                cls.demonum = 0;
        }
 
        // unload all sounds so they will be reloaded from the new files as needed
-       S_UnloadAllSounds_f(cmd_client);
+       S_UnloadAllSounds_f(cmd_local);
 
        // restart the video subsystem after the config is executed
-       Cbuf_InsertText(cmd_client, "\nloadconfig\nvid_restart\n\n");
+       Cbuf_InsertText(cmd_local, "\nloadconfig\nvid_restart\n\n");
 
        return true;
 }
@@ -2507,6 +2510,20 @@ int FS_CheckNastyPath (const char *path, qbool isgamedir)
        return false;
 }
 
+/*
+====================
+FS_SanitizePath
+
+Sanitize path (replace non-portable characters 
+with portable ones in-place, etc)
+====================
+*/
+void FS_SanitizePath(char *path)
+{
+       for (; *path; path++)
+               if (*path == '\\')
+                       *path = '/';
+}
 
 /*
 ====================